private void bind( OioDatagramChannel channel, ChannelFuture future, SocketAddress localAddress) { boolean bound = false; boolean workerStarted = false; try { channel.socket.bind(localAddress); bound = true; // Fire events future.setSuccess(); fireChannelBound(channel, channel.getLocalAddress()); // Start the business. DeadLockProofWorker.start( workerExecutor, new ThreadRenamingRunnable( new OioDatagramWorker(channel), "Old I/O datagram worker (" + channel + ')', determiner)); workerStarted = true; } catch (Throwable t) { future.setFailure(t); fireExceptionCaught(channel, t); } finally { if (bound && !workerStarted) { AbstractOioWorker.close(channel, future); } } }
connect(channel, future, (SocketAddress) value); } else { OioDatagramWorker.disconnect(channel, future); OioDatagramWorker.write( channel, future, evt.getMessage(), evt.getRemoteAddress());
static void write( OioDatagramChannel channel, ChannelFuture future, Object message, SocketAddress remoteAddress) { boolean iothread = isIoThread(channel);
static void disconnect(OioDatagramChannel channel, ChannelFuture future) { boolean connected = channel.isConnected(); boolean iothread = isIoThread(channel); try { channel.socket.disconnect(); future.setSuccess(); if (connected) { // Notify. if (iothread) { fireChannelDisconnected(channel); } else { fireChannelDisconnectedLater(channel); } } } catch (Throwable t) { future.setFailure(t); if (iothread) { fireExceptionCaught(channel, t); } else { fireExceptionCaughtLater(channel, t); } } } }
workerExecutor, new ThreadRenamingRunnable( new OioDatagramWorker(channel), threadName, determiner)); } else {