Skip to content

Commit

Permalink
Experiment providing random access to fields.
Browse files Browse the repository at this point in the history
Fix #11811 with javadoc and an optional random access implementation.
  • Loading branch information
gregw committed May 27, 2024
1 parent f64c059 commit c8dc5ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void testDump() throws Exception
testSimpleGET();
((QueuedThreadPool)(_server.getThreadPool())).tryExecute(() -> {});
String dump = _server.dump();
// System.err.println(dump);
assertThat(dump, containsString("oejs.Server@"));
assertThat(dump, containsString("QueuedThreadPool"));
assertThat(dump, containsString("+= ReservedThreadExecutor@"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ static String dump(Dumpable dumpable)
return b.toString();
}

DateTimeFormatter UTC_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneOffset.UTC);
DateTimeFormatter LOCAL_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS Z").withZone(ZoneId.of(System.getProperty("user.timezone")));

/**
* Utility method to dump to an {@link Appendable}
*
Expand All @@ -87,9 +84,11 @@ static void dump(Dumpable dumpable, Appendable out)
out.append(KEY);
Runtime runtime = Runtime.getRuntime();
Instant now = Instant.now();
out.append("JVM: %s %s; OS: %s %s %s; Jetty: %s; CPUs: %d; mem(free/total/max): %,d/%,d/%,d MB\nUTC: %s; %s: %s".formatted(
System.getProperty("java.runtime.name"),
System.getProperty("java.runtime.version"),
String zone = System.getProperty("user.timezone");
out.append("JVM: %s %s %s; OS: %s %s %s; Jetty: %s; CPUs: %d; mem(free/total/max): %,d/%,d/%,d MiB\nUTC: %s; %s: %s".formatted(
System.getProperty("java.vm.vendor"),
System.getProperty("java.vm.name"),
System.getProperty("java.vm.version"),
System.getProperty("os.name"),
System.getProperty("os.arch"),
System.getProperty("os.version"),
Expand All @@ -98,9 +97,9 @@ static void dump(Dumpable dumpable, Appendable out)
runtime.freeMemory() / (1024 * 1024),
runtime.totalMemory() / (1024 * 1024),
runtime.maxMemory() / (1024 * 1024),
UTC_FORMATTER.format(now),
System.getProperty("user.timezone"),
LOCAL_FORMATTER.format(now)));
DateTimeFormatter.ISO_DATE_TIME.format(now.atOffset(ZoneOffset.UTC)),
zone,
DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now.atZone(ZoneId.of(zone)))));
}
catch (IOException e)
{
Expand Down

0 comments on commit c8dc5ad

Please sign in to comment.