Use InternalLogger in our code / Use jul in examples
This commit is contained in:
parent
3f16f0b4d2
commit
5218f38ed0
@ -16,14 +16,15 @@
|
|||||||
package io.netty.handler.codec.socks;
|
package io.netty.handler.codec.socks;
|
||||||
|
|
||||||
import io.netty.channel.embedded.EmbeddedByteChannel;
|
import io.netty.channel.embedded.EmbeddedByteChannel;
|
||||||
|
import io.netty.util.internal.InternalLogger;
|
||||||
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class SocksAuthResponseDecoderTest {
|
public class SocksAuthResponseDecoderTest {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SocksAuthResponseDecoderTest.class);
|
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SocksAuthResponseDecoderTest.class);
|
||||||
|
|
||||||
private static void testSocksAuthResponseDecoderWithDifferentParams(SocksAuthStatus authStatus){
|
private static void testSocksAuthResponseDecoderWithDifferentParams(SocksAuthStatus authStatus){
|
||||||
logger.debug("Testing SocksAuthResponseDecoder with authStatus: "+ authStatus);
|
logger.debug("Testing SocksAuthResponseDecoder with authStatus: "+ authStatus);
|
||||||
SocksAuthResponse msg = new SocksAuthResponse(authStatus);
|
SocksAuthResponse msg = new SocksAuthResponse(authStatus);
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
package io.netty.handler.codec.socks;
|
package io.netty.handler.codec.socks;
|
||||||
|
|
||||||
import io.netty.channel.embedded.EmbeddedByteChannel;
|
import io.netty.channel.embedded.EmbeddedByteChannel;
|
||||||
|
import io.netty.util.internal.InternalLogger;
|
||||||
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import sun.net.util.IPAddressUtil;
|
import sun.net.util.IPAddressUtil;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class SocksCmdRequestDecoderTest {
|
public class SocksCmdRequestDecoderTest {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SocksCmdRequestDecoderTest.class);
|
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SocksCmdRequestDecoderTest.class);
|
||||||
|
|
||||||
private static void testSocksCmdRequestDecoderWithDifferentParams(SocksCmdType cmdType, SocksAddressType addressType, String host, int port) {
|
private static void testSocksCmdRequestDecoderWithDifferentParams(SocksCmdType cmdType, SocksAddressType addressType, String host, int port) {
|
||||||
logger.debug("Testing cmdType: " + cmdType + " addressType: " + addressType + " host: " + host + " port: " + port);
|
logger.debug("Testing cmdType: " + cmdType + " addressType: " + addressType + " host: " + host + " port: " + port);
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
package io.netty.handler.codec.socks;
|
package io.netty.handler.codec.socks;
|
||||||
|
|
||||||
import io.netty.channel.embedded.EmbeddedByteChannel;
|
import io.netty.channel.embedded.EmbeddedByteChannel;
|
||||||
|
import io.netty.util.internal.InternalLogger;
|
||||||
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class SocksCmdResponseDecoderTest {
|
public class SocksCmdResponseDecoderTest {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SocksCmdResponseDecoderTest.class);
|
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SocksCmdResponseDecoderTest.class);
|
||||||
|
|
||||||
private static void testSocksCmdResponseDecoderWithDifferentParams(SocksCmdStatus cmdStatus, SocksAddressType addressType){
|
private static void testSocksCmdResponseDecoderWithDifferentParams(SocksCmdStatus cmdStatus, SocksAddressType addressType){
|
||||||
logger.debug("Testing cmdStatus: " + cmdStatus + " addressType: " + addressType);
|
logger.debug("Testing cmdStatus: " + cmdStatus + " addressType: " + addressType);
|
||||||
|
@ -25,11 +25,10 @@ import io.netty.example.udt.util.UtilConsoleReporter;
|
|||||||
import io.netty.example.udt.util.UtilThreadFactory;
|
import io.netty.example.udt.util.UtilThreadFactory;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Byte Stream Client
|
* UDT Byte Stream Client
|
||||||
@ -41,8 +40,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class ByteEchoClient {
|
public class ByteEchoClient {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(ByteEchoClient.class.getName());
|
||||||
.getLogger(ByteEchoClient.class);
|
|
||||||
|
|
||||||
private final String host;
|
private final String host;
|
||||||
private final int port;
|
private final int port;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.example.udt.echo.bytes;
|
package io.netty.example.udt.echo.bytes;
|
||||||
|
|
||||||
|
import com.yammer.metrics.Metrics;
|
||||||
|
import com.yammer.metrics.core.Meter;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
@ -23,12 +25,8 @@ import io.netty.channel.ChannelOption;
|
|||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.slf4j.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.yammer.metrics.Metrics;
|
|
||||||
import com.yammer.metrics.core.Meter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo client. It initiates the ping-pong
|
* Handler implementation for the echo client. It initiates the ping-pong
|
||||||
@ -37,8 +35,7 @@ import com.yammer.metrics.core.Meter;
|
|||||||
*/
|
*/
|
||||||
public class ByteEchoClientHandler extends ChannelInboundByteHandlerAdapter {
|
public class ByteEchoClientHandler extends ChannelInboundByteHandlerAdapter {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(ByteEchoClientHandler.class.getName());
|
||||||
.getLogger(ByteEchoClientHandler.class.getName());
|
|
||||||
|
|
||||||
private final ByteBuf message;
|
private final ByteBuf message;
|
||||||
|
|
||||||
@ -55,8 +52,7 @@ public class ByteEchoClientHandler extends ChannelInboundByteHandlerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
log.info("ECHO active {}", NioUdtProvider.socketUDT(ctx.channel())
|
log.info("ECHO active " + NioUdtProvider.socketUDT(ctx.channel()).toStringOptions());
|
||||||
.toStringOptions());
|
|
||||||
ctx.write(message);
|
ctx.write(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +69,7 @@ public class ByteEchoClientHandler extends ChannelInboundByteHandlerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(final ChannelHandlerContext ctx,
|
public void exceptionCaught(final ChannelHandlerContext ctx,
|
||||||
final Throwable cause) {
|
final Throwable cause) {
|
||||||
log.error("close the connection when an exception is raised", cause);
|
log.log(Level.WARNING, "close the connection when an exception is raised", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,9 @@ import io.netty.channel.udt.nio.NioUdtProvider;
|
|||||||
import io.netty.example.udt.util.UtilThreadFactory;
|
import io.netty.example.udt.util.UtilThreadFactory;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Byte Stream Server
|
* UDT Byte Stream Server
|
||||||
@ -37,8 +36,7 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
*/
|
*/
|
||||||
public class ByteEchoServer {
|
public class ByteEchoServer {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(ByteEchoServer.class.getName());
|
||||||
.getLogger(ByteEchoServer.class);
|
|
||||||
|
|
||||||
private final int port;
|
private final int port;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ import io.netty.channel.ChannelInboundByteHandlerAdapter;
|
|||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import java.util.logging.Level;
|
||||||
import org.slf4j.LoggerFactory;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo server.
|
* Handler implementation for the echo server.
|
||||||
@ -31,8 +31,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
@Sharable
|
@Sharable
|
||||||
public class ByteEchoServerHandler extends ChannelInboundByteHandlerAdapter {
|
public class ByteEchoServerHandler extends ChannelInboundByteHandlerAdapter {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(ByteEchoServerHandler.class.getName());
|
||||||
.getLogger(ByteEchoServerHandler.class.getName());
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inboundBufferUpdated(final ChannelHandlerContext ctx,
|
public void inboundBufferUpdated(final ChannelHandlerContext ctx,
|
||||||
@ -46,14 +45,13 @@ public class ByteEchoServerHandler extends ChannelInboundByteHandlerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(final ChannelHandlerContext ctx,
|
public void exceptionCaught(final ChannelHandlerContext ctx,
|
||||||
final Throwable cause) {
|
final Throwable cause) {
|
||||||
log.error("close the connection when an exception is raised", cause);
|
log.log(Level.WARNING, "close the connection when an exception is raised", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
log.info("ECHO active {}", NioUdtProvider.socketUDT(ctx.channel())
|
log.info("ECHO active " + NioUdtProvider.socketUDT(ctx.channel()).toStringOptions());
|
||||||
.toStringOptions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,11 +25,10 @@ import io.netty.example.udt.util.UtilConsoleReporter;
|
|||||||
import io.netty.example.udt.util.UtilThreadFactory;
|
import io.netty.example.udt.util.UtilThreadFactory;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Message Flow client
|
* UDT Message Flow client
|
||||||
@ -41,8 +40,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class MsgEchoClient {
|
public class MsgEchoClient {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(MsgEchoClient.class.getName());
|
||||||
.getLogger(MsgEchoClient.class);
|
|
||||||
|
|
||||||
private final String host;
|
private final String host;
|
||||||
private final int port;
|
private final int port;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.example.udt.echo.message;
|
package io.netty.example.udt.echo.message;
|
||||||
|
|
||||||
|
import com.yammer.metrics.Metrics;
|
||||||
|
import com.yammer.metrics.core.Meter;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.MessageBuf;
|
import io.netty.buffer.MessageBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
@ -24,12 +26,8 @@ import io.netty.channel.udt.UdtMessage;
|
|||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.slf4j.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.yammer.metrics.Metrics;
|
|
||||||
import com.yammer.metrics.core.Meter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo client. It initiates the ping-pong
|
* Handler implementation for the echo client. It initiates the ping-pong
|
||||||
@ -39,8 +37,7 @@ import com.yammer.metrics.core.Meter;
|
|||||||
public class MsgEchoClientHandler extends
|
public class MsgEchoClientHandler extends
|
||||||
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(MsgEchoClientHandler.class.getName());
|
||||||
.getLogger(MsgEchoClientHandler.class.getName());
|
|
||||||
|
|
||||||
private final UdtMessage message;
|
private final UdtMessage message;
|
||||||
|
|
||||||
@ -57,8 +54,7 @@ public class MsgEchoClientHandler extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
log.info("ECHO active {}", NioUdtProvider.socketUDT(ctx.channel())
|
log.info("ECHO active " + NioUdtProvider.socketUDT(ctx.channel()).toStringOptions());
|
||||||
.toStringOptions());
|
|
||||||
final MessageBuf<Object> out = ctx.nextOutboundMessageBuffer();
|
final MessageBuf<Object> out = ctx.nextOutboundMessageBuffer();
|
||||||
out.add(message);
|
out.add(message);
|
||||||
ctx.flush();
|
ctx.flush();
|
||||||
@ -67,7 +63,7 @@ public class MsgEchoClientHandler extends
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(final ChannelHandlerContext ctx,
|
public void exceptionCaught(final ChannelHandlerContext ctx,
|
||||||
final Throwable cause) {
|
final Throwable cause) {
|
||||||
log.error("close the connection when an exception is raised", cause);
|
log.log(Level.WARNING, "close the connection when an exception is raised", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,9 @@ import io.netty.channel.udt.nio.NioUdtProvider;
|
|||||||
import io.netty.example.udt.util.UtilThreadFactory;
|
import io.netty.example.udt.util.UtilThreadFactory;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Message Flow Server
|
* UDT Message Flow Server
|
||||||
@ -37,8 +36,7 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
*/
|
*/
|
||||||
public class MsgEchoServer {
|
public class MsgEchoServer {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(MsgEchoServer.class.getName());
|
||||||
.getLogger(MsgEchoServer.class);
|
|
||||||
|
|
||||||
private final int port;
|
private final int port;
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ import io.netty.channel.ChannelHandlerContext;
|
|||||||
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
|
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
|
||||||
import io.netty.channel.udt.UdtMessage;
|
import io.netty.channel.udt.UdtMessage;
|
||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo server.
|
* Handler implementation for the echo server.
|
||||||
@ -31,20 +32,18 @@ import org.slf4j.LoggerFactory;
|
|||||||
public class MsgEchoServerHandler extends
|
public class MsgEchoServerHandler extends
|
||||||
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(MsgEchoServerHandler.class.getName());
|
||||||
.getLogger(MsgEchoServerHandler.class.getName());
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(final ChannelHandlerContext ctx,
|
public void exceptionCaught(final ChannelHandlerContext ctx,
|
||||||
final Throwable cause) {
|
final Throwable cause) {
|
||||||
log.error("close the connection when an exception is raised", cause);
|
log.log(Level.WARNING, "close the connection when an exception is raised", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
log.info("ECHO active {}", NioUdtProvider.socketUDT(ctx.channel())
|
log.info("ECHO active " + NioUdtProvider.socketUDT(ctx.channel()).toStringOptions());
|
||||||
.toStringOptions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,5 +53,4 @@ public class MsgEchoServerHandler extends
|
|||||||
out.add(message);
|
out.add(message);
|
||||||
ctx.flush();
|
ctx.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,11 @@ import io.netty.bootstrap.Bootstrap;
|
|||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
|
import io.netty.channel.udt.UdtChannel;
|
||||||
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
import io.netty.example.udt.util.UtilThreadFactory;
|
import io.netty.example.udt.util.UtilThreadFactory;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import io.netty.channel.udt.UdtChannel;
|
|
||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
@ -38,9 +36,6 @@ import java.util.concurrent.ThreadFactory;
|
|||||||
*/
|
*/
|
||||||
public abstract class MsgEchoPeerBase {
|
public abstract class MsgEchoPeerBase {
|
||||||
|
|
||||||
protected static final Logger log = LoggerFactory
|
|
||||||
.getLogger(MsgEchoPeerBase.class);
|
|
||||||
|
|
||||||
protected final int messageSize;
|
protected final int messageSize;
|
||||||
protected final InetSocketAddress self;
|
protected final InetSocketAddress self;
|
||||||
protected final InetSocketAddress peer;
|
protected final InetSocketAddress peer;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.example.udt.echo.rendevous;
|
package io.netty.example.udt.echo.rendevous;
|
||||||
|
|
||||||
|
import com.yammer.metrics.Metrics;
|
||||||
|
import com.yammer.metrics.core.Meter;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.MessageBuf;
|
import io.netty.buffer.MessageBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
@ -24,12 +26,8 @@ import io.netty.channel.udt.UdtMessage;
|
|||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.slf4j.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.yammer.metrics.Metrics;
|
|
||||||
import com.yammer.metrics.core.Meter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo peer. It initiates the ping-pong traffic
|
* Handler implementation for the echo peer. It initiates the ping-pong traffic
|
||||||
@ -39,8 +37,7 @@ import com.yammer.metrics.core.Meter;
|
|||||||
public class MsgEchoPeerHandler extends
|
public class MsgEchoPeerHandler extends
|
||||||
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = Logger.getLogger(MsgEchoPeerHandler.class.getName());
|
||||||
.getLogger(MsgEchoPeerHandler.class.getName());
|
|
||||||
|
|
||||||
private final UdtMessage message;
|
private final UdtMessage message;
|
||||||
|
|
||||||
@ -57,8 +54,7 @@ public class MsgEchoPeerHandler extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
|
||||||
log.info("ECHO active {}", NioUdtProvider.socketUDT(ctx.channel())
|
log.info("ECHO active " + NioUdtProvider.socketUDT(ctx.channel()).toStringOptions());
|
||||||
.toStringOptions());
|
|
||||||
final MessageBuf<Object> out = ctx.nextOutboundMessageBuffer();
|
final MessageBuf<Object> out = ctx.nextOutboundMessageBuffer();
|
||||||
out.add(message);
|
out.add(message);
|
||||||
ctx.flush();
|
ctx.flush();
|
||||||
@ -67,7 +63,7 @@ public class MsgEchoPeerHandler extends
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(final ChannelHandlerContext ctx,
|
public void exceptionCaught(final ChannelHandlerContext ctx,
|
||||||
final Throwable cause) {
|
final Throwable cause) {
|
||||||
log.error("close the connection when an exception is raised", cause);
|
log.log(Level.WARNING, "close the connection when an exception is raised", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package io.netty.example.udt.echo.rendevous;
|
package io.netty.example.udt.echo.rendevous;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Message Flow Peer
|
* UDT Message Flow Peer
|
||||||
@ -25,6 +26,8 @@ import java.net.InetSocketAddress;
|
|||||||
*/
|
*/
|
||||||
public class MsgEchoPeerOne extends MsgEchoPeerBase {
|
public class MsgEchoPeerOne extends MsgEchoPeerBase {
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(MsgEchoPeerOne.class.getName());
|
||||||
|
|
||||||
public MsgEchoPeerOne(final InetSocketAddress self,
|
public MsgEchoPeerOne(final InetSocketAddress self,
|
||||||
final InetSocketAddress peer, final int messageSize) {
|
final InetSocketAddress peer, final int messageSize) {
|
||||||
super(self, peer, messageSize);
|
super(self, peer, messageSize);
|
||||||
|
@ -19,6 +19,7 @@ import io.netty.example.udt.util.UtilConsoleReporter;
|
|||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UDT Message Flow Peer
|
* UDT Message Flow Peer
|
||||||
@ -28,6 +29,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
*/
|
*/
|
||||||
public class MsgEchoPeerTwo extends MsgEchoPeerBase {
|
public class MsgEchoPeerTwo extends MsgEchoPeerBase {
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(MsgEchoPeerTwo.class.getName());
|
||||||
|
|
||||||
public MsgEchoPeerTwo(final InetSocketAddress self,
|
public MsgEchoPeerTwo(final InetSocketAddress self,
|
||||||
final InetSocketAddress peer, final int messageSize) {
|
final InetSocketAddress peer, final int messageSize) {
|
||||||
super(self, peer, messageSize);
|
super(self, peer, messageSize);
|
||||||
|
@ -27,9 +27,8 @@ import io.netty.test.udt.util.CustomReporter;
|
|||||||
import io.netty.test.udt.util.EchoMessageHandler;
|
import io.netty.test.udt.util.EchoMessageHandler;
|
||||||
import io.netty.test.udt.util.TrafficControl;
|
import io.netty.test.udt.util.TrafficControl;
|
||||||
import io.netty.test.udt.util.UnitHelp;
|
import io.netty.test.udt.util.UnitHelp;
|
||||||
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -43,7 +42,7 @@ public final class UdtNetty {
|
|||||||
private UdtNetty() {
|
private UdtNetty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(UdtNetty.class);
|
static final InternalLogger log = InternalLoggerFactory.getInstance(UdtNetty.class);
|
||||||
|
|
||||||
/** benchmark duration */
|
/** benchmark duration */
|
||||||
static final int time = 10 * 60 * 1000;
|
static final int time = 10 * 60 * 1000;
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
package io.netty.test.udt.util;
|
package io.netty.test.udt.util;
|
||||||
|
|
||||||
import com.google.caliper.SimpleBenchmark;
|
import com.google.caliper.SimpleBenchmark;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.LoggerFactory;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for caliper/metrics benchmarks.
|
* Base class for caliper/metrics benchmarks.
|
||||||
@ -41,7 +41,7 @@ public abstract class CaliperBench extends SimpleBenchmark {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
protected final InternalLogger log = InternalLoggerFactory.getInstance(getClass());
|
||||||
|
|
||||||
private volatile CaliperMeasure measure;
|
private volatile CaliperMeasure measure;
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ import com.google.caliper.Scenario;
|
|||||||
import com.google.caliper.ScenarioResult;
|
import com.google.caliper.ScenarioResult;
|
||||||
import com.google.caliper.SimpleBenchmark;
|
import com.google.caliper.SimpleBenchmark;
|
||||||
import com.yammer.metrics.core.TimerContext;
|
import com.yammer.metrics.core.TimerContext;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.LoggerFactory;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -50,8 +50,7 @@ import java.util.TreeSet;
|
|||||||
*/
|
*/
|
||||||
public final class CaliperRunner {
|
public final class CaliperRunner {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory
|
private final static InternalLogger log = InternalLoggerFactory.getInstance(CaliperRunner.class);
|
||||||
.getLogger(CaliperRunner.class);
|
|
||||||
|
|
||||||
private CaliperRunner() {
|
private CaliperRunner() {
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,15 @@
|
|||||||
|
|
||||||
package io.netty.test.udt.util;
|
package io.netty.test.udt.util;
|
||||||
|
|
||||||
|
import com.yammer.metrics.core.Meter;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundByteHandlerAdapter;
|
import io.netty.channel.ChannelInboundByteHandlerAdapter;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.yammer.metrics.core.Meter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo client. It initiates the ping-pong
|
* Handler implementation for the echo client. It initiates the ping-pong
|
||||||
@ -35,8 +33,7 @@ import com.yammer.metrics.core.Meter;
|
|||||||
*/
|
*/
|
||||||
public class EchoByteHandler extends ChannelInboundByteHandlerAdapter {
|
public class EchoByteHandler extends ChannelInboundByteHandlerAdapter {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final InternalLogger log = InternalLoggerFactory.getInstance(EchoByteHandler.class);
|
||||||
.getLogger(EchoByteHandler.class.getName());
|
|
||||||
|
|
||||||
private final ByteBuf message;
|
private final ByteBuf message;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import io.netty.channel.ChannelHandlerContext;
|
|||||||
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
|
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
|
||||||
import io.netty.channel.udt.UdtMessage;
|
import io.netty.channel.udt.UdtMessage;
|
||||||
import io.netty.channel.udt.nio.NioUdtProvider;
|
import io.netty.channel.udt.nio.NioUdtProvider;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.LoggerFactory;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler implementation for the echo peer. It initiates the ping-pong traffic
|
* Handler implementation for the echo peer. It initiates the ping-pong traffic
|
||||||
@ -35,8 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
public class EchoMessageHandler extends
|
public class EchoMessageHandler extends
|
||||||
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
ChannelInboundMessageHandlerAdapter<UdtMessage> {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final InternalLogger log = InternalLoggerFactory.getInstance(EchoMessageHandler.class);
|
||||||
.getLogger(EchoMessageHandler.class.getName());
|
|
||||||
|
|
||||||
private final Meter meter;
|
private final Meter meter;
|
||||||
private final UdtMessage message;
|
private final UdtMessage message;
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package io.netty.test.udt.util;
|
package io.netty.test.udt.util;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.LoggerFactory;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Introduce traffic control, such as transfer latency.
|
* Introduce traffic control, such as transfer latency.
|
||||||
@ -28,8 +28,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
*/
|
*/
|
||||||
public final class TrafficControl {
|
public final class TrafficControl {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final InternalLogger log = InternalLoggerFactory.getInstance(TrafficControl.class);
|
||||||
.getLogger(TrafficControl.class.getName());
|
|
||||||
|
|
||||||
private TrafficControl() {
|
private TrafficControl() {
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ package io.netty.test.udt.util;
|
|||||||
|
|
||||||
import com.barchart.udt.SocketUDT;
|
import com.barchart.udt.SocketUDT;
|
||||||
import com.barchart.udt.StatusUDT;
|
import com.barchart.udt.StatusUDT;
|
||||||
import org.slf4j.Logger;
|
import io.netty.util.internal.InternalLogger;
|
||||||
import org.slf4j.LoggerFactory;
|
import io.netty.util.internal.InternalLoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -37,7 +37,7 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public final class UnitHelp {
|
public final class UnitHelp {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(UnitHelp.class);
|
private static final InternalLogger log = InternalLoggerFactory.getInstance(UnitHelp.class);
|
||||||
private static final Pattern SPACES = Pattern.compile("\\s+");
|
private static final Pattern SPACES = Pattern.compile("\\s+");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user