io.netty.util.concurrent.Promise.setUncancellable()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中io.netty.util.concurrent.Promise.setUncancellable()方法的一些代码示例,展示了Promise.setUncancellable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Promise.setUncancellable()方法的具体详情如下:
包路径:io.netty.util.concurrent.Promise
类名称:Promise
方法名:setUncancellable

Promise.setUncancellable介绍

[英]Make this future impossible to cancel.
[中]让这个未来无法取消。

代码示例

代码示例来源:origin: redisson/redisson

@Override
public boolean setUncancellable() {
  return promise.setUncancellable();
}

代码示例来源:origin: redisson/redisson

@Override
public boolean setUncancellable() {
  return promise.setUncancellable();
}

代码示例来源:origin: line/armeria

@Override
public boolean setUncancellable() {
  return delegate.setUncancellable();
}

代码示例来源:origin: org.opendaylight.controller/netconf-client

@GuardedBy("this")
private void dispatchRequest() {
  while (!requests.isEmpty()) {
    final RequestEntry e = requests.peek();
    if (e.promise.setUncancellable()) {
      LOG.debug("Sending message {}", e.request);
      clientSession.sendMessage(e.request);
      break;
    }
    LOG.debug("Message {} has been cancelled, skipping it", e.request);
    requests.poll();
  }
}

代码示例来源:origin: org.asynchttpclient/netty-resolver-dns

private void setSuccess(AddressedEnvelope<? extends DnsResponse, InetSocketAddress> envelope) {
  parent.queryContextManager.remove(nameServerAddr(), id);
  // Cancel the timeout task.
  final ScheduledFuture<?> timeoutFuture = this.timeoutFuture;
  if (timeoutFuture != null) {
    timeoutFuture.cancel(false);
  }
  Promise<AddressedEnvelope<DnsResponse, InetSocketAddress>> promise = this.promise;
  if (promise.setUncancellable()) {
    @SuppressWarnings("unchecked")
    AddressedEnvelope<DnsResponse, InetSocketAddress> castResponse =
        (AddressedEnvelope<DnsResponse, InetSocketAddress>) envelope.retain();
    promise.setSuccess(castResponse);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private void setSuccess(AddressedEnvelope<? extends DnsResponse, InetSocketAddress> envelope) {
  parent.queryContextManager.remove(nameServerAddr(), id);
  // Cancel the timeout task.
  final ScheduledFuture<?> timeoutFuture = this.timeoutFuture;
  if (timeoutFuture != null) {
    timeoutFuture.cancel(false);
  }
  Promise<AddressedEnvelope<DnsResponse, InetSocketAddress>> promise = this.promise;
  if (promise.setUncancellable()) {
    @SuppressWarnings("unchecked")
    AddressedEnvelope<DnsResponse, InetSocketAddress> castResponse =
        (AddressedEnvelope<DnsResponse, InetSocketAddress>) envelope.retain();
    if (!promise.trySuccess(castResponse)) {
      // We failed to notify the promise as it was failed before, thus we need to release the envelope
      envelope.release();
    }
  }
}

相关文章