本文整理了Java中io.netty.util.concurrent.Future.awaitUninterruptibly()
方法的一些代码示例,展示了Future.awaitUninterruptibly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Future.awaitUninterruptibly()
方法的具体详情如下:
包路径:io.netty.util.concurrent.Future
类名称:Future
方法名:awaitUninterruptibly
[英]Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.
[中]等待这个未来不间断地完成。此方法捕获InterruptedException并以静默方式丢弃它。
代码示例来源:origin: line/armeria
@Override
public Future<T> awaitUninterruptibly() {
return delegate.awaitUninterruptibly();
}
代码示例来源:origin: line/armeria
@Override
public boolean awaitUninterruptibly(long timeoutMillis) {
return delegate.awaitUninterruptibly(timeoutMillis);
}
代码示例来源:origin: line/armeria
@Override
public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {
return delegate.awaitUninterruptibly(timeout, unit);
}
代码示例来源:origin: Alluxio/alluxio
@Override
public void close() {
if (mServer != null) {
boolean completed = mServer.shutdown();
if (!completed) {
LOG.warn("RPC Server shutdown timed out.");
}
completed = mBossGroup.shutdownGracefully(mQuietPeriodMs, mTimeoutMs, TimeUnit.MILLISECONDS)
.awaitUninterruptibly(mTimeoutMs);
if (!completed) {
LOG.warn("Forced boss group shutdown because graceful shutdown timed out.");
}
completed = mWorkerGroup.shutdownGracefully(mQuietPeriodMs, mTimeoutMs, TimeUnit.MILLISECONDS)
.awaitUninterruptibly(mTimeoutMs);
if (!completed) {
LOG.warn("Forced worker group shutdown because graceful shutdown timed out.");
}
}
}
代码示例来源:origin: signalapp/Signal-Server
void connect(boolean sandbox) {
apnsClient.connect(sandbox ? ApnsClient.DEVELOPMENT_APNS_HOST : ApnsClient.PRODUCTION_APNS_HOST).awaitUninterruptibly();
}
代码示例来源:origin: netty/netty
@Override
public void close() {
if (executor.inEventLoop()) {
close0();
} else {
executor.submit(new Runnable() {
@Override
public void run() {
close0();
}
}).awaitUninterruptibly();
}
}
代码示例来源:origin: apache/incubator-pinot
/**
* Blocking call to wait for shutdown completely.
*/
public void waitForShutdown(long millis) {
LOGGER.info("Waiting for Shutdown");
if (_channel != null) {
LOGGER.info("Closing the server channel");
long endTime = System.currentTimeMillis() + millis;
ChannelFuture channelFuture = _channel.close();
Future<?> bossGroupFuture = _bossGroup.shutdownGracefully();
Future<?> workerGroupFuture = _workerGroup.shutdownGracefully();
long currentTime = System.currentTimeMillis();
if (endTime > currentTime) {
channelFuture.awaitUninterruptibly(endTime - currentTime, TimeUnit.MILLISECONDS);
}
currentTime = System.currentTimeMillis();
if (endTime > currentTime) {
bossGroupFuture.awaitUninterruptibly(endTime - currentTime, TimeUnit.MILLISECONDS);
}
currentTime = System.currentTimeMillis();
if (endTime > currentTime) {
workerGroupFuture.awaitUninterruptibly(endTime - currentTime, TimeUnit.MILLISECONDS);
}
Preconditions.checkState(channelFuture.isDone(), "Unable to close the channel in %s ms", millis);
Preconditions.checkState(bossGroupFuture.isDone(), "Unable to shutdown the boss group in %s ms", millis);
Preconditions.checkState(workerGroupFuture.isDone(), "Unable to shutdown the worker group in %s ms", millis);
}
}
代码示例来源:origin: redisson/redisson
@Override
public void close() {
if (executor.inEventLoop()) {
close0();
} else {
executor.submit(new Runnable() {
@Override
public void run() {
close0();
}
}).awaitUninterruptibly();
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void close() {
if (executor.inEventLoop()) {
close0();
} else {
executor.submit(new Runnable() {
@Override
public void run() {
close0();
}
}).awaitUninterruptibly();
}
}
代码示例来源:origin: alipay/sofa-bolt
/**
* Notice: only {@link GlobalSwitch#SERVER_MANAGE_CONNECTION_SWITCH} switch on, will close all connections.
*
* @see AbstractRemotingServer#doStop()
*/
@Override
protected boolean doStop() {
if (null != this.channelFuture) {
this.channelFuture.channel().close();
}
if (this.switches().isOn(GlobalSwitch.SERVER_SYNC_STOP)) {
this.bossGroup.shutdownGracefully().awaitUninterruptibly();
} else {
this.bossGroup.shutdownGracefully();
}
if (this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)
&& null != this.connectionManager) {
this.connectionManager.removeAll();
logger.warn("Close all connections from server side!");
}
logger.warn("Rpc Server stopped!");
return true;
}
代码示例来源:origin: wildfly/wildfly
if (sslHandler != null) {
Future<Channel> handshakeFuture = sslHandler.handshakeFuture();
if (handshakeFuture.awaitUninterruptibly(30000)) {
if (handshakeFuture.isSuccess()) {
ChannelPipeline channelPipeline = ch.pipeline();
代码示例来源:origin: apache/tinkerpop
void shutdown() {
group.shutdownGracefully().awaitUninterruptibly();
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public void close() throws IOException {
try {
channel.close().get();
} catch (Exception ignored) {
} finally {
group.shutdownGracefully().awaitUninterruptibly();
}
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public void close() throws IOException {
try {
channel.close().get();
} catch (Exception ignored) {
} finally {
group.shutdownGracefully().awaitUninterruptibly();
}
}
}
代码示例来源:origin: foxinmy/weixin4j
/**
* 关闭微信服务
*
* @param blocking
* 阻塞关闭
* @return
*/
public boolean shutdown(boolean blocking) {
if (bootstrap == null) {
return false;
}
ServerBootstrapConfig c = bootstrap.config();
Future<?> bossF = c.group().shutdownGracefully();
Future<?> workerF = c.childGroup().shutdownGracefully();
if (blocking) {
bossF.awaitUninterruptibly();
workerF.awaitUninterruptibly();
}
messageHandlerList = null;
messageInterceptorList = null;
messageDispatcher = null;
bootstrap = null;
return true;
}
代码示例来源:origin: org.opendaylight.bgpcep/pcep-impl
@Override
public void close() {
if (Epoll.isAvailable()) {
this.workerGroup.shutdownGracefully().awaitUninterruptibly();
this.bossGroup.shutdownGracefully().awaitUninterruptibly();
}
}
代码示例来源:origin: apache/jackrabbit-oak
private void closeGroup() {
if (group == null) {
return;
}
if (group.shutdownGracefully(2, 15, TimeUnit.SECONDS).awaitUninterruptibly(20, TimeUnit.SECONDS)) {
log.debug("Group shut down");
} else {
log.debug("Group shutdown timed out");
}
}
代码示例来源:origin: com.tinkerpop/gremlin-driver
@Override
public void close() throws IOException {
try {
channel.close().get();
} catch (Exception ignored) {
} finally {
group.shutdownGracefully().awaitUninterruptibly();
}
}
代码示例来源:origin: org.apache.cassandra/cassandra-all
/**
* Ultimately stops servers and closes all resources.
*/
public void destroy()
{
stop();
servers = Collections.emptyList();
// shutdown executors used by netty for native transport server
workerGroup.shutdownGracefully(3, 5, TimeUnit.SECONDS).awaitUninterruptibly();
// shutdownGracefully not implemented yet in RequestThreadPoolExecutor
eventExecutorGroup.shutdown();
}
代码示例来源:origin: org.apache.twill/twill-yarn
@Override
protected void shutDown() throws Exception {
channelGroup.close().awaitUninterruptibly();
List<Future<?>> futures = new ArrayList<>();
futures.add(bootstrap.config().group().shutdownGracefully(0, CLOSE_CHANNEL_TIMEOUT, TimeUnit.SECONDS));
futures.add(bootstrap.config().childGroup().shutdownGracefully(0, CLOSE_CHANNEL_TIMEOUT, TimeUnit.SECONDS));
for (Future<?> future : futures) {
future.awaitUninterruptibly();
}
LOG.info("Tracker service stopped at {}", url);
}
内容来源于网络,如有侵权,请联系作者删除!