code polish, formatting. Fixed class name typos

This commit is contained in:
nathan 2014-08-23 20:32:49 +02:00
parent 2a1e4d674f
commit 499e0bbfd7
8 changed files with 37 additions and 39 deletions

View File

@ -109,7 +109,8 @@ public class Client extends EndPointClient {
localBootstrap.group(boss)
.channel(LocalChannel.class)
.remoteAddress(new LocalAddress(options.localChannelName))
.handler(new RegistrationLocalHandlerClient(this.name, this.registrationWrapper));
.handler(new RegistrationLocalHandlerClient(this.name,
this.registrationWrapper));
manageForShutdown(boss);
}
@ -131,7 +132,9 @@ public class Client extends EndPointClient {
tcpBootstrap.group(boss)
.remoteAddress(options.host, options.tcpPort)
.handler(new RegistrationRemoteHandlerClientTCP(this.name, this.registrationWrapper, this.serializationManager));
.handler(new RegistrationRemoteHandlerClientTCP(this.name,
this.registrationWrapper,
this.serializationManager));
manageForShutdown(boss);
@ -160,7 +163,9 @@ public class Client extends EndPointClient {
udpBootstrap.group(boss)
.localAddress(new InetSocketAddress(0))
.remoteAddress(new InetSocketAddress(options.host, options.udpPort))
.handler(new RegistrationRemoteHandlerClientUDP(this.name, this.registrationWrapper, this.serializationManager));
.handler(new RegistrationRemoteHandlerClientUDP(this.name,
this.registrationWrapper,
this.serializationManager));
manageForShutdown(boss);
@ -200,25 +205,14 @@ public class Client extends EndPointClient {
udtBootstrap.group(boss)
.remoteAddress(options.host, options.udtPort)
.handler(new RegistrationRemoteHandlerClientUDT(this.name, this.registrationWrapper, this.serializationManager));
.handler(new RegistrationRemoteHandlerClientUDT(this.name,
this.registrationWrapper,
this.serializationManager));
manageForShutdown(boss);
}
}
}
// this thread will prevent the application from closing, since the JVM only exits when all non-daemon threads have ended.
// We will wait until Client.stop() is called before exiting.
// NOTE: if we are the webserver, then this method will be called for EVERY web connection made
// Thread exitThread = new Thread(new Runnable() {
// @Override
// public void run() {
// waitForStop();
// }
// });
// exitThread.setDaemon(false);
// exitThread.setName("Exit Monitor (Client)");
// exitThread.start();
}
/**

View File

@ -139,9 +139,10 @@ public class Server extends EndPointServer {
worker = new DefaultEventLoopGroup(DEFAULT_THREAD_POOL_SIZE, new NamedThreadFactory(this.name + "-worker-LOCAL", nettyGroup));
this.localBootstrap.group(boss, worker)
.channel(LocalServerChannel.class)
.localAddress(new LocalAddress(this.localChannelName))
.childHandler(new RegistrationLocalHandlerServer(this.name, this.registrationWrapper));
.channel(LocalServerChannel.class)
.localAddress(new LocalAddress(this.localChannelName))
.childHandler(new RegistrationLocalHandlerServer(this.name,
this.registrationWrapper));
manageForShutdown(boss);
manageForShutdown(worker);
@ -167,8 +168,10 @@ public class Server extends EndPointServer {
manageForShutdown(worker);
this.tcpBootstrap.group(boss, worker)
.option(ChannelOption.SO_BACKLOG, backlogConnectionCount)
.childHandler(new RegistrationRemoteHandlerServerTCP(this.name, this.registrationWrapper, this.serializationManager));
.option(ChannelOption.SO_BACKLOG, backlogConnectionCount)
.childHandler(new RegistrationRemoteHandlerServerTCP(this.name,
this.registrationWrapper,
this.serializationManager));
if (options.host != null) {
this.tcpBootstrap.localAddress(options.host, this.tcpPort);
@ -228,10 +231,12 @@ public class Server extends EndPointServer {
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(this.udtPort)
.childHandler(new RegistrationRemoteHandlerServerUDT(this.name, this.registrationWrapper, this.serializationManager));
.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(this.udtPort)
.childHandler(new RegistrationRemoteHandlerServerUDT(this.name,
this.registrationWrapper,
this.serializationManager));
manageForShutdown(boss);
manageForShutdown(worker);

View File

@ -12,41 +12,40 @@ public class ConnectionBridgeFlushAlways implements ConnectionBridge {
@Override
public void self(Object message) {
originalBridge.self(message);
this.originalBridge.self(message);
flush();
}
@Override
public ConnectionPoint TCP(Object message) {
ConnectionPoint connection = originalBridge.TCP(message);
ConnectionPoint connection = this.originalBridge.TCP(message);
connection.flush();
return connection;
}
@Override
public ConnectionPoint UDP(Object message) {
ConnectionPoint connection = originalBridge.UDP(message);
ConnectionPoint connection = this.originalBridge.UDP(message);
connection.flush();
return connection;
}
@Override
public ConnectionPoint UDT(Object message) {
ConnectionPoint connection = originalBridge.UDT(message);
ConnectionPoint connection = this.originalBridge.UDT(message);
connection.flush();
return connection;
}
@Override
public Ping ping() {
Ping ping = originalBridge.ping();
Ping ping = this.originalBridge.ping();
flush();
return ping;
}
@Override
public void flush() {
originalBridge.flush();
this.originalBridge.flush();
}
}

View File

@ -25,5 +25,5 @@ public interface ConnectionBridgeServer {
* Exposes methods to send the object to all server connections (except the specified one)
* over the network. (or via LOCAL when it's a local channel).
*/
public ConnectionExceptsBridgeServer except();
public ConnectionExceptSpecifiedBridgeServer except();
}

View File

@ -1,7 +1,7 @@
package dorkbox.network.connection;
public interface ConnectionExceptsBridgeServer {
public interface ConnectionExceptSpecifiedBridgeServer {
/**
* Sends the object to all server connections (except the specified one)

View File

@ -337,7 +337,7 @@ public abstract class EndPoint {
}
// This actually does the "stopping", since there is some logic to making sure we don't deadlock, this is important
private final void stopInThread () {
private final void stopInThread() {
// tell the blocked "bind" method that it may continue (and exit)
this.blockUntilDone.release();

View File

@ -2,7 +2,7 @@ package dorkbox.network.connection;
import java.util.Collection;
public class ServerConnectionBridge implements ConnectionBridgeServer, ConnectionExceptsBridgeServer {
public class ServerConnectionBridge implements ConnectionBridgeServer, ConnectionExceptSpecifiedBridgeServer {
private final ConnectionManager connectionManager;
@ -52,7 +52,7 @@ public class ServerConnectionBridge implements ConnectionBridgeServer, Connectio
* over the network. (or via LOCAL when it's a local channel).
*/
@Override
public ConnectionExceptsBridgeServer except() {
public ConnectionExceptSpecifiedBridgeServer except() {
return this;
}

View File

@ -84,8 +84,8 @@ public abstract class RegistrationHandler extends ChannelInboundHandlerAdapter {
}
} finally {
registrationWrapper.abortRegistrationIfClient();
registrationWrapper.releaseChannelMap();
registrationWrapper.abortRegistrationIfClient();
}
}