io.netty.channel.EventLoop.newPromise()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(274)

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

EventLoop.newPromise介绍

暂无

代码示例

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

@Override
public final Future<Void> release(Channel channel) {
  return release(channel, channel.eventLoop().<Void>newPromise());
}

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

@Override
public final Future<Void> release(Channel channel) {
  return release(channel, channel.eventLoop().<Void>newPromise());
}

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

@Override
public final Future<Void> release(Channel channel) {
  return release(channel, channel.eventLoop().<Void>newPromise());
}

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

public Future<Http2StreamChannel> open() {
  return open(channel.eventLoop().<Http2StreamChannel>newPromise());
}

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

/**
 * Sends a DNS query with the specified question using the specified name server list.
 */
public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
    InetSocketAddress nameServerAddr, DnsQuestion question) {
  return query0(nameServerAddr, question, EMPTY_ADDITIONALS, true, ch.newPromise(),
         ch.eventLoop().<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>>newPromise());
}

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

/**
 * Resolves the specified name into an address.
 *
 * @param inetHost the name to resolve
 * @param additionals additional records ({@code OPT})
 *
 * @return the address as the result of the resolution
 */
public final Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals) {
  return resolve(inetHost, additionals, executor().<InetAddress>newPromise());
}

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

/**
 * Resolves the specified host name and port into a list of address.
 *
 * @param inetHost the name to resolve
 * @param additionals additional records ({@code OPT})
 *
 * @return the list of the address as the result of the resolution
 */
public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) {
  return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise());
}

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

/**
 * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike
 * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers.
 * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured
 * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the
 * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned.
 *
 * @param question the question
 *
 * @return the list of the {@link DnsRecord}s as the result of the resolution
 */
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) {
  return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise());
}

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

/**
 * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike
 * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers.
 * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured
 * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the
 * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned.
 *
 * @param question the question
 * @param additionals additional records ({@code OPT})
 *
 * @return the list of the {@link DnsRecord}s as the result of the resolution
 */
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals) {
  return resolveAll(question, additionals, executor().<List<DnsRecord>>newPromise());
}

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

/**
 * Sends a DNS query with the specified question with additional records using the specified name server list.
 */
public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
    InetSocketAddress nameServerAddr, DnsQuestion question, Iterable<DnsRecord> additionals) {
  return query0(nameServerAddr, question, toArray(additionals, false), true, ch.newPromise(),
         ch.eventLoop().<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>>newPromise());
}

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

/**
 * Resolves the specified host name and port into a list of address.
 *
 * @param inetHost the name to resolve
 * @param additionals additional records ({@code OPT})
 *
 * @return the list of the address as the result of the resolution
 */
public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) {
  return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise());
}

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

/**
 * Sends a DNS query with the specified question using the specified name server list.
 */
public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
    InetSocketAddress nameServerAddr, DnsQuestion question) {
  return query0(nameServerAddr, question, EMPTY_ADDITIONALS,
      ch.eventLoop().<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>>newPromise());
}

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

/**
 * Resolves the specified name into an address.
 *
 * @param inetHost the name to resolve
 * @param additionals additional records ({@code OPT})
 *
 * @return the address as the result of the resolution
 */
public final Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals) {
  return resolve(inetHost, additionals, executor().<InetAddress>newPromise());
}

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

/**
 * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike
 * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers.
 * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured
 * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the
 * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned.
 *
 * @param question the question
 *
 * @return the list of the {@link DnsRecord}s as the result of the resolution
 */
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) {
  return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise());
}

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

@Override
public final Future<Channel> acquire() {
  return acquire(bootstrap.config().group().next().<Channel>newPromise());
}

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

private void doResolveUncached(String hostname,
                DnsRecord[] additionals,
                final Promise<InetAddress> promise,
                DnsCache resolveCache) {
  final Promise<List<InetAddress>> allPromise = executor().newPromise();
  doResolveAllUncached(hostname, additionals, allPromise, resolveCache);
  allPromise.addListener(new FutureListener<List<InetAddress>>() {
    @Override
    public void operationComplete(Future<List<InetAddress>> future) {
      if (future.isSuccess()) {
        trySuccess(promise, future.getNow().get(0));
      } else {
        tryFailure(promise, future.cause());
      }
    }
  });
}

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

/**
 * Sends a DNS query with the specified question with additional records using the specified name server list.
 */
public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query(
    InetSocketAddress nameServerAddr, DnsQuestion question, Iterable<DnsRecord> additionals) {
  return query0(nameServerAddr, question, toArray(additionals, false),
      ch.eventLoop().<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>>newPromise());
}

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

@Override
public final Future<Channel> acquire() {
  return acquire(bootstrap.config().group().next().<Channel>newPromise());
}

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

@Override
public final Future<Channel> acquire() {
  return acquire(bootstrap.config().group().next().<Channel>newPromise());
}

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

@Override
  public void operationComplete(Future<List<T>> future) {
    Throwable cause = future.cause();
    if (cause == null) {
      promise.trySuccess(future.getNow());
    } else {
      if (DnsNameResolver.isTransportOrTimeoutError(cause)) {
        promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname));
      } else if (searchDomainIdx < searchDomains.length) {
        Promise<List<T>> newPromise = parent.executor().newPromise();
        newPromise.addListener(this);
        doSearchDomainQuery(hostname + '.' + searchDomains[searchDomainIdx++], newPromise);
      } else if (!startWithoutSearchDomain) {
        internalResolve(hostname, promise);
      } else {
        promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname));
      }
    }
  }
});

相关文章