Replace system.out.println with InternalLoggerFactory

Motivation:

There are two files that still use `system.out.println` to log their status

Modification:

Replace `system.out.println` with a `debug` function inside an instance of `InternalLoggerFactory`

Result:

Introduce an instance of `InternalLoggerFactory` in class `AbstractMicrobenchmark.java` and `AbstractSharedExecutorMicrobenchmark.java`
This commit is contained in:
Ade Setyawan Sajim 2017-03-14 18:56:57 +01:00 committed by Norman Maurer
parent 71b338ce17
commit 016629fe3b
2 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,8 @@ package io.netty.microbench.util;
import io.netty.util.concurrent.DefaultThreadFactory;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -34,10 +36,12 @@ public class AbstractMicrobenchmark extends AbstractMicrobenchmarkBase {
protected static final int DEFAULT_FORKS = 2;
public static final class HarnessExecutor extends ThreadPoolExecutor {
private final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractMicrobenchmark.class);
public HarnessExecutor(int maxThreads, String prefix) {
super(maxThreads, maxThreads, 0, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), new DefaultThreadFactory(prefix));
System.out.println("Using harness executor");
logger.debug("Using harness executor");
}
}

View File

@ -21,6 +21,8 @@ import io.netty.util.concurrent.AbstractEventExecutor;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.ProgressivePromise;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.util.concurrent.TimeUnit;
@ -63,8 +65,10 @@ public class AbstractSharedExecutorMicrobenchmark extends AbstractMicrobenchmark
*/
public static final class DelegateHarnessExecutor extends AbstractEventExecutor {
private static EventLoop executor;
private InternalLogger logger = InternalLoggerFactory.getInstance(DelegateHarnessExecutor.class);
public DelegateHarnessExecutor(int maxThreads, String prefix) {
System.out.println("Using DelegateHarnessExecutor executor " + this);
logger.debug("Using DelegateHarnessExecutor executor {}", this);
}
/**