/** * Closes the internal datagram channel used for sending and receiving DNS messages, and clears all DNS resource * records from the cache. Attempting to send a DNS query or to resolve a domain name will fail once this method * has been called. */ @Override public void close() { if (ch.isOpen()) { ch.close(); } }
@Override public CompletableFuture<Void> stop() { if (channel != null) { CompletableFuture<Void> future = new CompletableFuture<>(); channel.close().addListener(f -> { started.set(false); group.shutdownGracefully(); future.complete(null); }); return future; } started.set(false); return CompletableFuture.completedFuture(null); }
@Override public synchronized void close(final Handler<AsyncResult<Void>> handler) { // make sure everything is flushed out on close if (!channel.isOpen()) { return; } channel.flush(); ChannelFuture future = channel.close(); if (handler != null) { future.addListener(new DatagramChannelFutureListener<>(null, handler, context)); } }
@Override public synchronized void close(final Handler<AsyncResult<Void>> handler) { // make sure everything is flushed out on close if (!channel.isOpen()) { return; } channel.flush(); ChannelFuture future = channel.close(); if (handler != null) { future.addListener(new DatagramChannelFutureListener<>(null, handler, context)); } }
@Override @SuppressWarnings("unchecked") protected Mono<Void> doShutdown() { return new MonoChannelFuture<ChannelFuture>(channel.close()) { @Override protected void doComplete(ChannelFuture future, Subscriber<? super Void> s) { if (null == getOptions() || null == getOptions().eventLoopGroup()) { MonoChannelFuture.from(ioGroup.shutdownGracefully()) .subscribe(s); } else { super.doComplete(future, s); } } }; }
@Override public CompletableFuture<Void> stop() { if (channel != null) { CompletableFuture<Void> future = new CompletableFuture<>(); channel.close().addListener(f -> { started.set(false); group.shutdownGracefully(); future.complete(null); }); return future; } started.set(false); return CompletableFuture.completedFuture(null); }
@Override public void close() { bootstrap.group().shutdownGracefully(); if (channel != null) { channel.close().syncUninterruptibly(); } }
/** * Closes the internal datagram channel used for sending and receiving DNS messages, and clears all DNS resource * records from the cache. Attempting to send a DNS query or to resolve a domain name will fail once this method * has been called. */ @Override public void close() { if (ch.isOpen()) { ch.close(); } }
/** * Stop the discovery process. */ public void stop() { searchFuture.cancel(true); channel.close(); }
/** * Closes the internal datagram channel used for sending and receiving DNS messages, and clears all DNS resource * records from the cache. Attempting to send a DNS query or to resolve a domain name will fail once this method * has been called. */ @Override public void close() { if (ch.isOpen()) { ch.close(); } }
@Override @SuppressWarnings("unchecked") protected Promise<Void> doShutdown() { final Promise<Void> d = Promises.prepare(); ChannelFuture future = channel.close(); final GenericFutureListener listener = new GenericFutureListener() { @Override public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { d.onComplete(); } else { d.onError(future.cause()); } } }; future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { d.onError(future.cause()); return; } if (null == nettyOptions || null == nettyOptions.eventLoopGroup()) { ioGroup.shutdownGracefully().addListener(listener); } } }); return d; }
private void clearConnections() { long tstart = System.currentTimeMillis(); channels.clearConnections(); if (bindUDP) { try { udpChannel.close().syncUninterruptibly(); } catch (Exception ex) { logger.warn("Error during Netty shutdown. Messages might have been lost! \n {}", ex); } } messages.clear(); long tend = System.currentTimeMillis(); logger.info("Closed all connections in {}ms", tend - tstart); }
cc.close().awaitUninterruptibly();
c.close().awaitUninterruptibly();