本文整理了Java中io.netty.util.Timeout.isExpired()
方法的一些代码示例,展示了Timeout.isExpired()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeout.isExpired()
方法的具体详情如下:
包路径:io.netty.util.Timeout
类名称:Timeout
方法名:isExpired
[英]Returns true if and only if the TimerTask associated with this handle has been expired.
[中]当且仅当与此句柄关联的TimerTask已过期时,返回true。
代码示例来源: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: mrniko/netty-socketio
@Override
public void schedule(final SchedulerKey key, final Runnable runnable, long delay, TimeUnit unit) {
Timeout timeout = executorService.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
try {
runnable.run();
} finally {
scheduledFutures.remove(key);
}
}
}, delay, unit);
if (!timeout.isExpired()) {
scheduledFutures.put(key, timeout);
}
}
代码示例来源:origin: mrniko/netty-socketio
@Override
public void scheduleCallback(final SchedulerKey key, final Runnable runnable, long delay, TimeUnit unit) {
Timeout timeout = executorService.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
ctx.executor().execute(new Runnable() {
@Override
public void run() {
try {
runnable.run();
} finally {
scheduledFutures.remove(key);
}
}
});
}
}, delay, unit);
if (!timeout.isExpired()) {
scheduledFutures.put(key, timeout);
}
}
代码示例来源: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: AsyncHttpClient/async-http-client
void startReadTimeout(ReadTimeoutTimerTask task) {
if (requestTimeout == null || (!requestTimeout.isExpired() && readTimeoutValue < (requestTimeoutMillisTime - unpreciseMillisTime()))) {
// only schedule a new readTimeout if the requestTimeout doesn't happen first
if (task == null) {
// first call triggered from outside (else is read timeout is re-scheduling itself)
task = new ReadTimeoutTimerTask(nettyResponseFuture, requestSender, this, readTimeoutValue);
}
this.readTimeout = newTimeout(task, readTimeoutValue);
} else if (task != null) {
// read timeout couldn't re-scheduling itself, clean up
task.clean();
}
}
代码示例来源:origin: org.opendaylight.netvirt/ipv6service-impl
public void cancelPeriodicTransmissionTimeout(Timeout timeout) {
if (timeout != null) {
synchronized (timeout) {
if (!timeout.isExpired()) {
timeout.cancel();
}
}
}
}
}
代码示例来源:origin: com.corundumstudio.socketio/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: com.corundumstudio.socketio/netty-socketio
@Override
public void schedule(final SchedulerKey key, final Runnable runnable, long delay, TimeUnit unit) {
Timeout timeout = executorService.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
try {
runnable.run();
} finally {
scheduledFutures.remove(key);
}
}
}, delay, unit);
if (!timeout.isExpired()) {
scheduledFutures.put(key, timeout);
}
}
代码示例来源:origin: com.corundumstudio.socketio/netty-socketio
@Override
public void scheduleCallback(final SchedulerKey key, final Runnable runnable, long delay, TimeUnit unit) {
Timeout timeout = executorService.newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
ctx.executor().execute(new Runnable() {
@Override
public void run() {
try {
runnable.run();
} finally {
scheduledFutures.remove(key);
}
}
});
}
}, delay, unit);
if (!timeout.isExpired()) {
scheduledFutures.put(key, timeout);
}
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
public Timeout setPeriodicWhileTimer(long delay){
LOG.debug("Entering setPeriodicWhileTimer for switchid={} port={}",swId,portId);
if((periodicTimeout != null) && (!periodicTimeout.isExpired())){
periodicTimeout.cancel();
}
LacpWheelTimer instance = TimerFactory.LacpWheelTimer.getInstance(Utils.timerWheeltype.PERIODIC_TIMER);
periodicTimeout=instance.registerPortForPeriodicTimer(periodicTimer,delay, TimeUnit.SECONDS);
LOG.debug("Exiting setPeriodicWhileTimer for switchid={} port={}",swId,portId);
return periodicTimeout;
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
public Timeout setCurrentWhileTimer(long delay){
LOG.debug("Entering setCurrentWhileTimer for switchid={} port={}",swId,portId);
if((currWhileTimeout!= null) && (!currWhileTimeout.isExpired())){
currWhileTimeout.cancel();
}
LacpWheelTimer instance = TimerFactory.LacpWheelTimer.getInstance(Utils.timerWheeltype.CURRENT_WHILE_TIMER);
currWhileTimeout=instance.registerPortForCurrentWhileTimer(currentWhileTimer,delay, TimeUnit.SECONDS);
LOG.debug("Exiting setCurrentWhileTimer for switchid={} port={}",swId,portId);
return currWhileTimeout;
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
public Timeout setWaitWhileTimer(long delay){
LOG.debug("Entering setWaitWhileTimer for switchid={} port={}",swId,portId);
if((waitWhileTimeout!= null) && (!waitWhileTimeout.isExpired())){
waitWhileTimeout.cancel();
}
LacpWheelTimer instance = TimerFactory.LacpWheelTimer.getInstance(Utils.timerWheeltype.WAIT_WHILE_TIMER);
waitWhileTimeout=instance.registerPortForWaitWhileTimer(waitWhileTimer,delay, TimeUnit.SECONDS);
LOG.debug("Exiting setWaitWhileTimer for switchid={} port={}",swId,portId);
return waitWhileTimeout;
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
public void executeStateAction(PeriodicTxContext obj, LacpPort portObjRef,LacpBpduInfo pdu)
{
LacpConst.PERIODIC_STATES flag = LacpConst.PERIODIC_STATES.SLOW_PERIODIC;
LOG.debug("Entering PeriodicTxPeriodicState executeStateAction, setting ntt to true for port={}", portObjRef.slaveGetPortId());
if(!portObjRef.getPeriodicWhileTimer().isExpired()){
portObjRef.getPeriodicWhileTimer().cancel();
}
portObjRef.setNtt(true);
if (!LacpUtil.isFast(portObjRef.portPartnerOperGetPortState()))
{
flag = LacpConst.PERIODIC_STATES.SLOW_PERIODIC;
}
else
{
flag = LacpConst.PERIODIC_STATES.FAST_PERIODIC;
}
obj.setState(portObjRef.getPeriodicTxState(flag));
obj.getState().executeStateAction(obj, portObjRef, pdu);
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
|| (rxContext.getState().getStateFlag() == LacpConst.RX_STATES.RX_CURRENT))){
if(!currWhileTimeout.isExpired()){
currWhileTimeout.cancel();
内容来源于网络,如有侵权,请联系作者删除!