public NioServerProcessor(NioServerConfig serverConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { super(eventHandler, channelInitializer); this.serverConfig = serverConfig; this.serverSocketChannel = newSocket(); }
@Override public Futures.WriteFuture writeAndFlush(Object msg) { return processor.writeAndFlush(this, msg); }
public void accept(SelectionKey key) { NioChannel channel = doAccept(selectorLoop); QUEUE_MAP.putIfAbsent(channel, new WriteQueue()); }
public Futures.ConnectFuture connect(SocketAddress remoteAddress) { Futures.ConnectFuture connectFuture = Futures.newConnectFuture(); NioChannel channel = doConnect(remoteAddress, selectorLoop, connectFuture); QUEUE_MAP.putIfAbsent(channel, new WriteQueue()); return connectFuture; }
public NioClient(NioClientConfig clientConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { this.processor = new NioClientProcessor(clientConfig, eventHandler, channelInitializer); }
public void flush(NioChannel channel) { doFlush(channel); }
public NioServer(NioServerConfig serverConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { this.serverConfig = serverConfig; setEventHandler(eventHandler); this.processor = new NioServerProcessor(serverConfig, this.eventHandler, channelInitializer); }
private void doMessageReceived(final NioChannel channel, final ByteBuffer message) { executor().execute(new Runnable() { @Override public void run() { try { List<Object> objs = channel.getDecoder().decode(channel, message); if (CollectionUtils.isNotEmpty(objs)) { for (Object obj : objs) { eventHandler().messageReceived(channel, obj); } } channel.setLastReadTime(SystemClock.now()); } catch (Exception e) { eventHandler().exceptionCaught(channel, e); } } }); }
private void doAccept(SelectionKey key) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("doAccept:" + key.toString()); } processor.accept(key); }
private void doConnect(SelectionKey key) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("doConnect:" + key.toString()); } processor.connect(key); }
public void accept(SelectionKey key) { NioChannel channel = doAccept(selectorLoop); QUEUE_MAP.putIfAbsent(channel, new WriteQueue()); }
public Futures.ConnectFuture connect(SocketAddress remoteAddress) { Futures.ConnectFuture connectFuture = Futures.newConnectFuture(); NioChannel channel = doConnect(remoteAddress, selectorLoop, connectFuture); QUEUE_MAP.putIfAbsent(channel, new WriteQueue()); return connectFuture; }
public NioServerProcessor(NioServerConfig serverConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { super(eventHandler, channelInitializer); this.serverConfig = serverConfig; this.serverSocketChannel = newSocket(); }
@Override public Futures.WriteFuture writeAndFlush(Object msg) { return processor.writeAndFlush(this, msg); }
public NioClient(NioClientConfig clientConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { this.processor = new NioClientProcessor(clientConfig, eventHandler, channelInitializer); }
public void flush(NioChannel channel) { doFlush(channel); }
public NioServer(NioServerConfig serverConfig, NioHandler eventHandler, ChannelInitializer channelInitializer) { this.serverConfig = serverConfig; setEventHandler(eventHandler); this.processor = new NioServerProcessor(serverConfig, this.eventHandler, channelInitializer); }
private void doMessageReceived(final NioChannel channel, final ByteBuffer message) { executor().execute(new Runnable() { @Override public void run() { try { List<Object> objs = channel.getDecoder().decode(channel, message); if (CollectionUtils.isNotEmpty(objs)) { for (Object obj : objs) { eventHandler().messageReceived(channel, obj); } } channel.setLastReadTime(SystemClock.now()); } catch (Exception e) { eventHandler().exceptionCaught(channel, e); } } }); }