Skip to content

Commit

Permalink
Switch to system.err.println to avoid checkstyle rules
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Oct 6, 2023
1 parent a47dfcb commit ddbe342
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private Long runResourceTest(
CompletableFuture<Void> statPrinter = statsPrinter ? CompletableFuture.runAsync(() -> {
while (true) {
printStats();
System.out.println(" & Succesful completions: " + getCount.get());
System.err.println(" & Succesful completions: " + getCount.get());
try {
Thread.sleep(500);
} catch (Exception e) {
Expand All @@ -159,7 +159,7 @@ private Long runResourceTest(

if (statsPrinter) {
printStats();
System.out.println(" & Succesful completions: " + getCount.get());
System.err.println(" & Succesful completions: " + getCount.get());
}
return getCount.get();
}
Expand Down Expand Up @@ -207,7 +207,7 @@ private byte[] createCompressedRequestBody(final RequestBodySize size) {
gzipOutputStream.finish();

final byte[] compressedRequestBody = byteArrayOutputStream.toByteArray();
System.out.println(
System.err.println(
"^^^"
+ String.format(
"Original size was %,d bytes, compressed to %,d bytes, ratio %,.2f",
Expand All @@ -223,7 +223,7 @@ private byte[] createCompressedRequestBody(final RequestBodySize size) {
}

private void printStats() {
System.out.println("** Stats ");
System.err.println("** Stats ");
printMemory();
printMemoryPools();
printGCPools();
Expand All @@ -236,21 +236,21 @@ private void printMemory() {
final long freeMemory = runtime.freeMemory(); // Amount of free memory
final long usedMemory = totalMemory - freeMemory; // Amount of used memory

System.out.println(" Memory Total: " + totalMemory + " Free:" + freeMemory + " Used:" + usedMemory);
System.err.println(" Memory Total: " + totalMemory + " Free:" + freeMemory + " Used:" + usedMemory);
}

private void printMemoryPools() {
List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans();
for (MemoryPoolMXBean memoryPool : memoryPools) {
MemoryUsage usage = memoryPool.getUsage();
System.out.println(" " + memoryPool.getName() + " USED: " + usage.getUsed() + " MAX: " + usage.getMax());
System.err.println(" " + memoryPool.getName() + " USED: " + usage.getUsed() + " MAX: " + usage.getMax());
}
}

private void printGCPools() {
List<GarbageCollectorMXBean> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean garbageCollector : garbageCollectors) {
System.out.println(" " + garbageCollector.getName() + " COLLECTION TIME: " + garbageCollector.getCollectionTime());
System.err.println(" " + garbageCollector.getName() + " COLLECTION TIME: " + garbageCollector.getCollectionTime());
}
}

Expand Down

0 comments on commit ddbe342

Please sign in to comment.