private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
private void checkConnectionState() { if (this.closed || !this.channel.isActive()) { throw new IllegalStateException("Connection " + getID() + " closed or disconnected"); } }
@Override public final String toString() { return super.toString() + "[ID=" + getID() + ", local= " + channel.localAddress() + ", remote=" + channel.remoteAddress() + "]"; }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
@Test public void testGetID() throws Exception { Channel channel = createChannel(); NettyConnection conn = new NettyConnection(emptyMap, channel, new MyListener(), false, false); Assert.assertEquals(channel.id(), conn.getID()); }