本文整理了Java中io.netty.util.Timeout.cancel()
方法的一些代码示例,展示了Timeout.cancel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeout.cancel()
方法的具体详情如下:
包路径:io.netty.util.Timeout
类名称:Timeout
方法名:cancel
[英]Cancels the TimerTask associated with this handle. It the task has been executed or cancelled already, it will return with no side effect.
[中]取消与此句柄关联的TimerTask。如果任务已经执行或取消,它将返回,不会产生任何副作用。
代码示例来源:origin: apache/pulsar
public void cancelStatsTimeout() {
if (statTimeout != null) {
statTimeout.cancel();
statTimeout = null;
}
}
代码示例来源:origin: apache/incubator-pinot
protected void cancelLastRequestTimeout() {
if (null != _lastRequestTimeout) {
_lastRequestTimeout.cancel(); //If task is already executed, no side-effect
_lastRequestTimeout = null;
}
}
代码示例来源:origin: mrniko/netty-socketio
@Override
public void cancel(SchedulerKey key) {
Timeout timeout = scheduledFutures.remove(key);
if (timeout != null) {
timeout.cancel();
}
}
代码示例来源:origin: mrniko/netty-socketio
@Override
public void cancel(SchedulerKey key) {
Timeout timeout = scheduledFutures.remove(key);
if (timeout != null) {
timeout.cancel();
}
}
代码示例来源:origin: qunarcorp/qmq
public void cancel(T key) {
Timeout timeout = timeouts.remove(key);
if (timeout == null) return;
timeout.cancel();
}
代码示例来源:origin: apache/pulsar
@Override
public CompletableFuture<Void> closeAsync() {
Timeout timeout = recheckPatternTimeout;
if (timeout != null) {
timeout.cancel();
recheckPatternTimeout = null;
}
return super.closeAsync();
}
代码示例来源:origin: mrniko/netty-socketio
private void replaceScheduledFuture(final SchedulerKey key, final Timeout newTimeout) {
final Timeout oldTimeout;
if (newTimeout.isExpired()) {
// no need to put already expired timeout to scheduledFutures map.
// simply remove old timeout
oldTimeout = scheduledFutures.remove(key);
} else {
oldTimeout = scheduledFutures.put(key, newTimeout);
}
// if there was old timeout, cancel it
if (oldTimeout != null) {
oldTimeout.cancel();
}
}
}
代码示例来源:origin: AsyncHttpClient/async-http-client
public void cancel() {
if (cancelled.compareAndSet(false, true)) {
if (requestTimeout != null) {
requestTimeout.cancel();
RequestTimeoutTimerTask.class.cast(requestTimeout.task()).clean();
}
if (readTimeout != null) {
readTimeout.cancel();
ReadTimeoutTimerTask.class.cast(readTimeout.task()).clean();
}
}
}
代码示例来源:origin: apache/pulsar
private void stop() {
writeLock.lock();
try {
if (timeout != null && !timeout.isCancelled()) {
timeout.cancel();
}
this.clear();
} finally {
writeLock.unlock();
}
}
代码示例来源:origin: redisson/redisson
void cancelExpirationRenewal(Long threadId) {
ExpirationEntry task = expirationRenewalMap.get(getEntryName());
if (task != null && (threadId == null || task.getThreadId() == threadId)) {
expirationRenewalMap.remove(getEntryName());
task.getTimeout().cancel();
}
}
代码示例来源:origin: redisson/redisson
oldTimeout.getTask().cancel();
timeout.cancel();
代码示例来源:origin: redisson/redisson
void cancelExpirationRenewal(Long threadId) {
ExpirationEntry task = expirationRenewalMap.get(getEntryName());
if (task != null && (threadId == null || task.getThreadId() == threadId)) {
expirationRenewalMap.remove(getEntryName());
task.getTimeout().cancel();
}
}
代码示例来源:origin: qunarcorp/qmq
public void refreshHeartbeat(T key, TimerTask task, long timeout, TimeUnit unit) {
Timeout context = timer.newTimeout(task, timeout, unit);
final Timeout old = timeouts.put(key, context);
if (old != null && !old.isCancelled() && !old.isExpired()) {
old.cancel();
}
}
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<Void> future) throws Exception {
if (future.isCancelled() && connectionFuture.cancel(false)) {
log.debug("Connection obtaining canceled for batch");
details.getTimeout().cancel();
if (attemptPromise.cancel(false)) {
free(entry);
}
}
}
};
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<Void> future) throws Exception {
if (future.isCancelled() && connectionFuture.cancel(false)) {
log.debug("Connection obtaining canceled for batch");
details.getTimeout().cancel();
if (attemptPromise.cancel(false)) {
free(entry);
}
}
}
};
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<R> future) throws Exception {
if (future.isCancelled() && connectionFuture.cancel(false)) {
log.debug("Connection obtaining canceled for {}", command);
details.getTimeout().cancel();
if (details.getAttemptPromise().cancel(false)) {
free(params);
}
}
}
};
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<R> future) throws Exception {
if (future.isCancelled() && connectionFuture.cancel(false)) {
log.debug("Connection obtaining canceled for {}", command);
details.getTimeout().cancel();
if (details.getAttemptPromise().cancel(false)) {
free(params);
}
}
}
};
代码示例来源:origin: lettuce-io/lettuce-core
void prepareClose() {
setListenOnChannelInactive(false);
setReconnectSuspended(true);
Timeout reconnectScheduleTimeout = this.reconnectScheduleTimeout;
if (reconnectScheduleTimeout != null && !reconnectScheduleTimeout.isCancelled()) {
reconnectScheduleTimeout.cancel();
}
reconnectionHandler.prepareClose();
}
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<R> future) throws Exception {
if (scheduledFuture != null) {
scheduledFuture.cancel();
}
synchronized (listener) {
connectionManager.getShutdownPromise().removeListener(listener);
}
// handling cancel operation for blocking commands
if (future.isCancelled() && !details.getAttemptPromise().isDone()) {
log.debug("Canceled blocking operation {} used {}", details.getCommand(), connection);
connection.forceFastReconnectAsync().addListener(new FutureListener<Void>() {
@Override
public void operationComplete(Future<Void> future) throws Exception {
details.getAttemptPromise().cancel(true);
}
});
return;
}
if (future.cause() instanceof RedissonShutdownException) {
details.getAttemptPromise().tryFailure(future.cause());
}
}
});
代码示例来源:origin: redisson/redisson
@Override
public void operationComplete(Future<R> future) throws Exception {
if (scheduledFuture != null) {
scheduledFuture.cancel();
}
synchronized (listener) {
connectionManager.getShutdownPromise().removeListener(listener);
}
// handling cancel operation for blocking commands
if (future.isCancelled() && !details.getAttemptPromise().isDone()) {
log.debug("Canceled blocking operation {} used {}", details.getCommand(), connection);
connection.forceFastReconnectAsync().addListener(new FutureListener<Void>() {
@Override
public void operationComplete(Future<Void> future) throws Exception {
details.getAttemptPromise().cancel(true);
}
});
return;
}
if (future.cause() instanceof RedissonShutdownException) {
details.getAttemptPromise().tryFailure(future.cause());
}
}
});
内容来源于网络,如有侵权,请联系作者删除!