Wrapped logger.info into check for infoEnabled
This commit is contained in:
parent
28f6b65336
commit
43e77086d0
|
@ -22,6 +22,8 @@ import java.util.Enumeration;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import dorkbox.network.pipeline.discovery.ClientDiscoverHostHandler;
|
||||
import dorkbox.network.pipeline.discovery.ClientDiscoverHostInitializer;
|
||||
|
||||
|
@ -95,13 +97,16 @@ public class Broadcast {
|
|||
|
||||
List<InetAddress> servers = new ArrayList<InetAddress>();
|
||||
|
||||
logger.info("Searching for host on port: {}", udpPort);
|
||||
Logger logger2 = logger;
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Searching for host on port: {}", udpPort);
|
||||
}
|
||||
|
||||
Enumeration<NetworkInterface> networkInterfaces;
|
||||
try {
|
||||
networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
} catch (SocketException e) {
|
||||
logger.error("Host discovery failed.", e);
|
||||
logger2.error("Host discovery failed.", e);
|
||||
return new ArrayList<InetAddress>(0);
|
||||
}
|
||||
|
||||
|
@ -114,7 +119,9 @@ public class Broadcast {
|
|||
|
||||
// don't use IPv6!
|
||||
if (address instanceof Inet6Address) {
|
||||
logger.info("Not using IPv6 address: {}", address);
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Not using IPv6 address: {}", address);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -134,12 +141,12 @@ public class Broadcast {
|
|||
future = udpBootstrap.bind();
|
||||
future.await();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("Could not bind to random UDP address on the server.", e.getCause());
|
||||
logger2.error("Could not bind to random UDP address on the server.", e.getCause());
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
if (!future.isSuccess()) {
|
||||
logger.error("Could not bind to random UDP address on the server.", future.cause());
|
||||
logger2.error("Could not bind to random UDP address on the server.", future.cause());
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
|
@ -151,7 +158,9 @@ public class Broadcast {
|
|||
|
||||
// response is received. If the channel is not closed within 5 seconds, move to the next one.
|
||||
if (!channel1.closeFuture().awaitUninterruptibly(discoverTimeoutMillis)) {
|
||||
logger.info("Host discovery timed out.");
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Host discovery timed out.");
|
||||
}
|
||||
} else {
|
||||
InetSocketAddress attachment = channel1.attr(ClientDiscoverHostHandler.STATE).get();
|
||||
servers.add(attachment.getAddress());
|
||||
|
@ -181,7 +190,9 @@ public class Broadcast {
|
|||
|
||||
// response is received. If the channel is not closed within 5 seconds, move to the next one.
|
||||
if (!channel1.closeFuture().awaitUninterruptibly(discoverTimeoutMillis)) {
|
||||
logger.info("Host discovery timed out.");
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Host discovery timed out.");
|
||||
}
|
||||
} else {
|
||||
InetSocketAddress attachment = channel1.attr(ClientDiscoverHostHandler.STATE).get();
|
||||
servers.add(attachment.getAddress());
|
||||
|
@ -208,16 +219,16 @@ public class Broadcast {
|
|||
|
||||
|
||||
|
||||
if (logger.isInfoEnabled() && !servers.isEmpty()) {
|
||||
if (logger2.isInfoEnabled() && !servers.isEmpty()) {
|
||||
if (fetchAllServers) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("Discovered servers: (").append(servers.size()).append(")");
|
||||
for (InetAddress server : servers) {
|
||||
stringBuilder.append("/n").append(server).append(":").append(udpPort);
|
||||
}
|
||||
logger.info(stringBuilder.toString());
|
||||
logger2.info(stringBuilder.toString());
|
||||
} else {
|
||||
logger.info("Discovered server: {}:{}", servers.get(0), udpPort);
|
||||
logger2.info("Discovered server: {}:{}", servers.get(0), udpPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.net.InetSocketAddress;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import dorkbox.network.connection.Connection;
|
||||
import dorkbox.network.connection.ConnectionBridge;
|
||||
import dorkbox.network.connection.ConnectionBridgeFlushAlways;
|
||||
|
@ -68,11 +70,12 @@ public class Client extends EndPointClient {
|
|||
public Client(ConnectionOptions options) throws InitializationException, SecurityException {
|
||||
super("Client", options);
|
||||
|
||||
Logger logger2 = this.logger;
|
||||
if (options.localChannelName != null && (options.tcpPort > 0 || options.udpPort > 0 || options.host != null) ||
|
||||
options.localChannelName == null && (options.tcpPort == 0 || options.udpPort == 0 || options.host == null)
|
||||
) {
|
||||
String msg = this.name + " Local channel use and TCP/UDP use are MUTUALLY exclusive. Unable to determine intent.";
|
||||
this.logger.error(msg);
|
||||
logger2.error(msg);
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
|
||||
|
@ -80,7 +83,9 @@ public class Client extends EndPointClient {
|
|||
|
||||
if (isAndroid && options.udtPort > 0) {
|
||||
// Android does not support UDT.
|
||||
this.logger.info("Android does not support UDT.");
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Android does not support UDT.");
|
||||
}
|
||||
options.udtPort = -1;
|
||||
}
|
||||
|
||||
|
@ -178,7 +183,7 @@ public class Client extends EndPointClient {
|
|||
Class.forName("com.barchart.udt.nio.SelectorProviderUDT");
|
||||
udtAvailable = true;
|
||||
} catch (Throwable e) {
|
||||
this.logger.error("Requested a UDT connection on port {}, but the barchart UDT libraries are not loaded.", options.udtPort);
|
||||
logger2.error("Requested a UDT connection on port {}, but the barchart UDT libraries are not loaded.", options.udtPort);
|
||||
}
|
||||
|
||||
if (udtAvailable) {
|
||||
|
|
|
@ -14,6 +14,9 @@ import io.netty.channel.socket.nio.NioDatagramChannel;
|
|||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.channel.socket.oio.OioDatagramChannel;
|
||||
import io.netty.channel.socket.oio.OioServerSocketChannel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import dorkbox.network.connection.EndPointServer;
|
||||
import dorkbox.network.connection.registration.local.RegistrationLocalHandlerServer;
|
||||
import dorkbox.network.connection.registration.remote.RegistrationRemoteHandlerServerTCP;
|
||||
|
@ -65,9 +68,12 @@ public class Server extends EndPointServer {
|
|||
// you have to make sure to use this.serializatino
|
||||
super("Server", options);
|
||||
|
||||
Logger logger2 = this.logger;
|
||||
if (isAndroid && options.udtPort > 0) {
|
||||
// Android does not support UDT.
|
||||
logger.info("Android does not support UDT.");
|
||||
if (logger2.isInfoEnabled()) {
|
||||
logger2.info("Android does not support UDT.");
|
||||
}
|
||||
options.udtPort = -1;
|
||||
}
|
||||
|
||||
|
@ -77,41 +83,41 @@ public class Server extends EndPointServer {
|
|||
|
||||
this.localChannelName = options.localChannelName;
|
||||
|
||||
if (localChannelName != null ) {
|
||||
localBootstrap = new ServerBootstrap();
|
||||
if (this.localChannelName != null ) {
|
||||
this.localBootstrap = new ServerBootstrap();
|
||||
} else {
|
||||
localBootstrap = null;
|
||||
this.localBootstrap = null;
|
||||
}
|
||||
|
||||
if (tcpPort > 0) {
|
||||
tcpBootstrap = new ServerBootstrap();
|
||||
if (this.tcpPort > 0) {
|
||||
this.tcpBootstrap = new ServerBootstrap();
|
||||
} else {
|
||||
tcpBootstrap = null;
|
||||
this.tcpBootstrap = null;
|
||||
}
|
||||
|
||||
if (udpPort > 0) {
|
||||
udpBootstrap = new Bootstrap();
|
||||
if (this.udpPort > 0) {
|
||||
this.udpBootstrap = new Bootstrap();
|
||||
} else {
|
||||
udpBootstrap = null;
|
||||
this.udpBootstrap = null;
|
||||
}
|
||||
|
||||
if (udtPort > 0) {
|
||||
if (this.udtPort > 0) {
|
||||
// check to see if we have UDT available!
|
||||
boolean udtAvailable = false;
|
||||
try {
|
||||
Class.forName("com.barchart.udt.nio.SelectorProviderUDT");
|
||||
udtAvailable = true;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Requested a UDT service on port {}, but the barchart UDT libraries are not loaded.", udtPort);
|
||||
logger2.error("Requested a UDT service on port {}, but the barchart UDT libraries are not loaded.", this.udtPort);
|
||||
}
|
||||
|
||||
if (udtAvailable) {
|
||||
udtBootstrap = new ServerBootstrap();
|
||||
this.udtBootstrap = new ServerBootstrap();
|
||||
} else {
|
||||
udtBootstrap = null;
|
||||
this.udtBootstrap = null;
|
||||
}
|
||||
} else {
|
||||
udtBootstrap = null;
|
||||
this.udtBootstrap = null;
|
||||
}
|
||||
|
||||
//TODO: do we need to set the snd/rcv buffer?
|
||||
|
@ -120,7 +126,7 @@ public class Server extends EndPointServer {
|
|||
|
||||
// setup the thread group to easily ID what the following threads belong to (and their spawned threads...)
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
ThreadGroup nettyGroup = new ThreadGroup(s != null ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(), name + " (Netty)");
|
||||
ThreadGroup nettyGroup = new ThreadGroup(s != null ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(), this.name + " (Netty)");
|
||||
|
||||
|
||||
// always use local channels on the server.
|
||||
|
@ -128,74 +134,74 @@ public class Server extends EndPointServer {
|
|||
EventLoopGroup boss;
|
||||
EventLoopGroup worker;
|
||||
|
||||
if (localBootstrap != null) {
|
||||
boss = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(name + "-boss-LOCAL", nettyGroup));
|
||||
worker = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(name + "-worker-LOCAL", nettyGroup));
|
||||
if (this.localBootstrap != null) {
|
||||
boss = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-boss-LOCAL", nettyGroup));
|
||||
worker = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-worker-LOCAL", nettyGroup));
|
||||
|
||||
localBootstrap.group(boss, worker)
|
||||
this.localBootstrap.group(boss, worker)
|
||||
.channel(LocalServerChannel.class)
|
||||
.localAddress(new LocalAddress(this.localChannelName))
|
||||
.childHandler(new RegistrationLocalHandlerServer(name, registrationWrapper));
|
||||
.childHandler(new RegistrationLocalHandlerServer(this.name, this.registrationWrapper));
|
||||
|
||||
manageForShutdown(boss);
|
||||
manageForShutdown(worker);
|
||||
}
|
||||
}
|
||||
|
||||
if (tcpBootstrap != null) {
|
||||
if (this.tcpBootstrap != null) {
|
||||
EventLoopGroup boss;
|
||||
EventLoopGroup worker;
|
||||
|
||||
if (isAndroid) {
|
||||
// android ONLY supports OIO (not NIO)
|
||||
boss = new OioEventLoopGroup(0, new NamedThreadFactory(name + "-boss-TCP", nettyGroup));
|
||||
worker = new OioEventLoopGroup(0, new NamedThreadFactory(name + "-worker-TCP", nettyGroup));
|
||||
tcpBootstrap.channel(OioServerSocketChannel.class);
|
||||
boss = new OioEventLoopGroup(0, new NamedThreadFactory(this.name + "-boss-TCP", nettyGroup));
|
||||
worker = new OioEventLoopGroup(0, new NamedThreadFactory(this.name + "-worker-TCP", nettyGroup));
|
||||
this.tcpBootstrap.channel(OioServerSocketChannel.class);
|
||||
} else {
|
||||
boss = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(name + "-boss-TCP", nettyGroup));
|
||||
worker = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(name + "-worker-TCP", nettyGroup));
|
||||
tcpBootstrap.channel(NioServerSocketChannel.class);
|
||||
boss = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-boss-TCP", nettyGroup));
|
||||
worker = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-worker-TCP", nettyGroup));
|
||||
this.tcpBootstrap.channel(NioServerSocketChannel.class);
|
||||
}
|
||||
|
||||
manageForShutdown(boss);
|
||||
manageForShutdown(worker);
|
||||
|
||||
tcpBootstrap.group(boss, worker)
|
||||
this.tcpBootstrap.group(boss, worker)
|
||||
.option(ChannelOption.SO_BACKLOG, backlogConnectionCount)
|
||||
.childHandler(new RegistrationRemoteHandlerServerTCP(name, registrationWrapper, serializationManager));
|
||||
.childHandler(new RegistrationRemoteHandlerServerTCP(this.name, this.registrationWrapper, this.serializationManager));
|
||||
|
||||
if (options.host != null) {
|
||||
tcpBootstrap.localAddress(options.host, tcpPort);
|
||||
this.tcpBootstrap.localAddress(options.host, this.tcpPort);
|
||||
} else {
|
||||
tcpBootstrap.localAddress(tcpPort);
|
||||
this.tcpBootstrap.localAddress(this.tcpPort);
|
||||
}
|
||||
|
||||
// android screws up on this!!
|
||||
tcpBootstrap.option(ChannelOption.TCP_NODELAY, !isAndroid);
|
||||
tcpBootstrap.childOption(ChannelOption.TCP_NODELAY, !isAndroid);
|
||||
this.tcpBootstrap.option(ChannelOption.TCP_NODELAY, !isAndroid);
|
||||
this.tcpBootstrap.childOption(ChannelOption.TCP_NODELAY, !isAndroid);
|
||||
|
||||
tcpBootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);
|
||||
this.tcpBootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);
|
||||
}
|
||||
|
||||
|
||||
if (udpBootstrap != null) {
|
||||
if (this.udpBootstrap != null) {
|
||||
EventLoopGroup worker;
|
||||
|
||||
if (isAndroid) {
|
||||
// android ONLY supports OIO (not NIO)
|
||||
worker = new OioEventLoopGroup(0, new NamedThreadFactory(name + "-worker-UDP", nettyGroup));
|
||||
udpBootstrap.channel(OioDatagramChannel.class);
|
||||
worker = new OioEventLoopGroup(0, new NamedThreadFactory(this.name + "-worker-UDP", nettyGroup));
|
||||
this.udpBootstrap.channel(OioDatagramChannel.class);
|
||||
} else {
|
||||
worker = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(name + "-worker-UDP", nettyGroup));
|
||||
udpBootstrap.channel(NioDatagramChannel.class);
|
||||
worker = new NioEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-worker-UDP", nettyGroup));
|
||||
this.udpBootstrap.channel(NioDatagramChannel.class);
|
||||
}
|
||||
|
||||
manageForShutdown(worker);
|
||||
|
||||
udpBootstrap.group(worker)
|
||||
this.udpBootstrap.group(worker)
|
||||
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
|
||||
.localAddress(udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!
|
||||
.handler(new RegistrationRemoteHandlerServerUDP(name, registrationWrapper, serializationManager));
|
||||
.localAddress(this.udpPort) // if you bind to a specific interface, Linux will be unable to receive broadcast packets!
|
||||
.handler(new RegistrationRemoteHandlerServerUDP(this.name, this.registrationWrapper, this.serializationManager));
|
||||
|
||||
|
||||
// Enable to READ from MULTICAST data (ie, 192.168.1.0)
|
||||
|
@ -206,26 +212,26 @@ public class Server extends EndPointServer {
|
|||
// THEN once done
|
||||
// socket.leaveGroup(group), close the socket
|
||||
// Enable to WRITE to MULTICAST data (ie, 192.168.1.0)
|
||||
udpBootstrap.option(ChannelOption.SO_BROADCAST, false);
|
||||
udpBootstrap.option(ChannelOption.SO_SNDBUF, udpMaxSize);
|
||||
this.udpBootstrap.option(ChannelOption.SO_BROADCAST, false);
|
||||
this.udpBootstrap.option(ChannelOption.SO_SNDBUF, udpMaxSize);
|
||||
}
|
||||
|
||||
|
||||
if (udtBootstrap != null) {
|
||||
if (this.udtBootstrap != null) {
|
||||
EventLoopGroup boss;
|
||||
EventLoopGroup worker;
|
||||
|
||||
// all of this must be proxied to another class, so THIS class doesn't have unmet dependencies.
|
||||
// Annoying and abusing the classloader, but it works well.
|
||||
boss = UdtEndpointProxy.getServerBoss(DEFAULT_THREAD_POOL_SIZE, name, nettyGroup);
|
||||
worker = UdtEndpointProxy.getServerWorker(DEFAULT_THREAD_POOL_SIZE, name, nettyGroup);
|
||||
boss = UdtEndpointProxy.getServerBoss(DEFAULT_THREAD_POOL_SIZE, this.name, nettyGroup);
|
||||
worker = UdtEndpointProxy.getServerWorker(DEFAULT_THREAD_POOL_SIZE, this.name, nettyGroup);
|
||||
|
||||
UdtEndpointProxy.setChannelFactory(udtBootstrap);
|
||||
udtBootstrap.group(boss, worker)
|
||||
UdtEndpointProxy.setChannelFactory(this.udtBootstrap);
|
||||
this.udtBootstrap.group(boss, worker)
|
||||
.option(ChannelOption.SO_BACKLOG, backlogConnectionCount)
|
||||
// not binding to specific address, since it's driven by TCP, and that can be bound to a specific address
|
||||
.localAddress(udtPort)
|
||||
.childHandler(new RegistrationRemoteHandlerServerUDT(name, registrationWrapper, serializationManager));
|
||||
.localAddress(this.udtPort)
|
||||
.childHandler(new RegistrationRemoteHandlerServerUDT(this.name, this.registrationWrapper, this.serializationManager));
|
||||
|
||||
manageForShutdown(boss);
|
||||
manageForShutdown(worker);
|
||||
|
@ -254,7 +260,7 @@ public class Server extends EndPointServer {
|
|||
public void bind(boolean blockUntilTerminate) {
|
||||
// make sure we are not trying to connect during a close or stop event.
|
||||
// This will wait until we have finished starting up/shutting down.
|
||||
synchronized (shutdownInProgress) {
|
||||
synchronized (this.shutdownInProgress) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,90 +269,90 @@ public class Server extends EndPointServer {
|
|||
ChannelFuture future;
|
||||
|
||||
// LOCAL
|
||||
if (localBootstrap != null) {
|
||||
if (this.localBootstrap != null) {
|
||||
try {
|
||||
future = localBootstrap.bind();
|
||||
future = this.localBootstrap.bind();
|
||||
future.await();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("Could not bind to LOCAL address on the server.", e.getCause());
|
||||
this.logger.error("Could not bind to LOCAL address on the server.", e.getCause());
|
||||
stop();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
if (!future.isSuccess()) {
|
||||
logger.error("Could not bind to LOCAL address on the server.", future.cause());
|
||||
this.logger.error("Could not bind to LOCAL address on the server.", future.cause());
|
||||
stop();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
logger.info("Listening on LOCAL address: '{}'", localChannelName);
|
||||
this.logger.info("Listening on LOCAL address: '{}'", this.localChannelName);
|
||||
manageForShutdown(future);
|
||||
}
|
||||
|
||||
|
||||
// TCP
|
||||
if (tcpBootstrap != null) {
|
||||
if (this.tcpBootstrap != null) {
|
||||
// Wait until the connection attempt succeeds or fails.
|
||||
try {
|
||||
future = tcpBootstrap.bind();
|
||||
future = this.tcpBootstrap.bind();
|
||||
future.await();
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not bind to TCP port {} on the server.", tcpPort, e.getCause());
|
||||
this.logger.error("Could not bind to TCP port {} on the server.", this.tcpPort, e.getCause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to TCP port");
|
||||
}
|
||||
|
||||
if (!future.isSuccess()) {
|
||||
logger.error("Could not bind to TCP port {} on the server.", tcpPort , future.cause());
|
||||
this.logger.error("Could not bind to TCP port {} on the server.", this.tcpPort , future.cause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to TCP port");
|
||||
}
|
||||
|
||||
logger.info("Listening on TCP port: {}", tcpPort);
|
||||
this.logger.info("Listening on TCP port: {}", this.tcpPort);
|
||||
manageForShutdown(future);
|
||||
}
|
||||
|
||||
// UDP
|
||||
if (udpBootstrap != null) {
|
||||
if (this.udpBootstrap != null) {
|
||||
// Wait until the connection attempt succeeds or fails.
|
||||
try {
|
||||
future = udpBootstrap.bind();
|
||||
future = this.udpBootstrap.bind();
|
||||
future.await();
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not bind to UDP port {} on the server.", udpPort, e.getCause());
|
||||
this.logger.error("Could not bind to UDP port {} on the server.", this.udpPort, e.getCause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to UDP port");
|
||||
}
|
||||
|
||||
if (!future.isSuccess()) {
|
||||
logger.error("Could not bind to UDP port {} on the server.", udpPort, future.cause());
|
||||
this.logger.error("Could not bind to UDP port {} on the server.", this.udpPort, future.cause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to UDP port");
|
||||
}
|
||||
|
||||
logger.info("Listening on UDP port: {}", udpPort);
|
||||
this.logger.info("Listening on UDP port: {}", this.udpPort);
|
||||
manageForShutdown(future);
|
||||
}
|
||||
|
||||
// UDT
|
||||
if (udtBootstrap != null) {
|
||||
if (this.udtBootstrap != null) {
|
||||
// Wait until the connection attempt succeeds or fails.
|
||||
try {
|
||||
future = udtBootstrap.bind();
|
||||
future = this.udtBootstrap.bind();
|
||||
future.await();
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not bind to UDT port {} on the server.", udtPort, e.getCause());
|
||||
this.logger.error("Could not bind to UDT port {} on the server.", this.udtPort, e.getCause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to UDT port");
|
||||
}
|
||||
|
||||
if (!future.isSuccess()) {
|
||||
logger.error("Could not bind to UDT port {} on the server.", udtPort, future.cause());
|
||||
this.logger.error("Could not bind to UDT port {} on the server.", this.udtPort, future.cause());
|
||||
stop();
|
||||
throw new IllegalArgumentException("Could not bind to UDT port");
|
||||
}
|
||||
|
||||
logger.info("Listening on UDT port: {}", udtPort);
|
||||
this.logger.info("Listening on UDT port: {}", this.udtPort);
|
||||
manageForShutdown(future);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue