Merge pull request #281 from ankurkaushal/master
Reformat according to google style guide
This commit is contained in:
@ -69,11 +69,13 @@ public class App {
|
||||
private Dispatcher dispatcher;
|
||||
|
||||
/**
|
||||
* Creates an instance of App which will use provided dispatcher for dispatching events on reactor.
|
||||
* Creates an instance of App which will use provided dispatcher for dispatching events on
|
||||
* reactor.
|
||||
*
|
||||
* @param dispatcher the dispatcher that will be used to dispatch events.
|
||||
*/
|
||||
public App(Dispatcher dispatcher) {
|
||||
this.dispatcher = dispatcher;
|
||||
this.dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +108,8 @@ public class App {
|
||||
* Our application binds to multiple channels and uses same logging handler to handle incoming
|
||||
* log requests.
|
||||
*/
|
||||
reactor.registerChannel(tcpChannel(6666, loggingHandler)).registerChannel(tcpChannel(6667, loggingHandler))
|
||||
reactor.registerChannel(tcpChannel(6666, loggingHandler))
|
||||
.registerChannel(tcpChannel(6667, loggingHandler))
|
||||
.registerChannel(udpChannel(6668, loggingHandler)).start();
|
||||
}
|
||||
|
||||
@ -120,7 +123,7 @@ public class App {
|
||||
reactor.stop();
|
||||
dispatcher.stop();
|
||||
for (AbstractNioChannel channel : channels) {
|
||||
channel.getJavaChannel().close();
|
||||
channel.getJavaChannel().close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,8 @@ public class AppClient {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
String message = clientName + " - Log request: " + i;
|
||||
DatagramPacket request = new DatagramPacket(message.getBytes(), message.getBytes().length, remoteAddress);
|
||||
DatagramPacket request =
|
||||
new DatagramPacket(message.getBytes(), message.getBytes().length, remoteAddress);
|
||||
|
||||
socket.send(request);
|
||||
|
||||
|
@ -24,7 +24,8 @@ public abstract class AbstractNioChannel {
|
||||
|
||||
private final SelectableChannel channel;
|
||||
private final ChannelHandler handler;
|
||||
private final Map<SelectableChannel, Queue<Object>> channelToPendingWrites = new ConcurrentHashMap<>();
|
||||
private final Map<SelectableChannel, Queue<Object>> channelToPendingWrites =
|
||||
new ConcurrentHashMap<>();
|
||||
private NioReactor reactor;
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,8 @@ public class NioServerSocketChannel extends AbstractNioChannel {
|
||||
*/
|
||||
@Override
|
||||
public void bind() throws IOException {
|
||||
((ServerSocketChannel) getJavaChannel()).socket().bind(new InetSocketAddress(InetAddress.getLocalHost(), port));
|
||||
((ServerSocketChannel) getJavaChannel()).socket().bind(
|
||||
new InetSocketAddress(InetAddress.getLocalHost(), port));
|
||||
((ServerSocketChannel) getJavaChannel()).configureBlocking(false);
|
||||
System.out.println("Bound TCP socket at port: " + port);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class AppTest {
|
||||
|
||||
app.stop();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the application using same thread dispatcher.
|
||||
*
|
||||
|
Reference in New Issue
Block a user