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

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

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

EventLoop.newSucceededFuture介绍

暂无

代码示例

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

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

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

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

代码示例来源:origin: alibaba/fescar

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

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

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

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

@Override
public <V> Future<V> newSucceededFuture(V result) {
  return new RequestContextAwareFuture<>(context(), delegate().newSucceededFuture(result));
}

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

.newSucceededFuture(null);
queriesInProgress.add(resolveFuture);

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

.newSucceededFuture(null);
queriesInProgress.add(resolveFuture);

代码示例来源:origin: apache/activemq-artemis

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

代码示例来源:origin: com.alibaba.fescar/fescar-core

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

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

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    EventLoop loop = channel.eventLoop();
    return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE);
  }
};

代码示例来源:origin: xjdr/xio

@Override
 public Future<Boolean> isHealthy(Channel channel) {
  EventLoop loop = channel.eventLoop();
  if (channel.isActive()) {
   passedHealthCheckCount.incrementAndGet();
   return loop.newSucceededFuture(Boolean.TRUE);
  } else {
   failedHealthCheckCount.incrementAndGet();
   return loop.newSucceededFuture(Boolean.FALSE);
  }
 }
};

代码示例来源:origin: aadnk/ProtocolLib

@Override
public <V> Future<V> newSucceededFuture(V arg0) {
  return getDelegate().newSucceededFuture(arg0);
}

代码示例来源:origin: com.simplyti.cloud/simple-server-clients

@Override
public Future<Boolean> isHealthy(Channel ch) {
  EventLoop loop = ch.eventLoop();
  if(ch.isActive()) {
    final Instant lastUsage = ch.attr(LAST_USAGE).getAndSet(Instant.now());
    if(poolConfig==null || poolConfig.maxIdle() <0 || lastUsage == null) {
      return loop.newSucceededFuture(Boolean.TRUE);
    }else {
      long iddleTime = ChronoUnit.SECONDS.between(lastUsage, Instant.now());
      if(iddleTime<=this.poolConfig.maxIdle() ) {
        return loop.newSucceededFuture(Boolean.TRUE);
      }else {
        return loop.newSucceededFuture(Boolean.FALSE);
      }
    }
  }else {
    return loop.newSucceededFuture(Boolean.FALSE);
  }
}

代码示例来源:origin: com.nike.riposte/riposte-core

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    // See if we've marked the channel as being non-usable first.
    if (channelIsMarkedAsBeingBroken(channel))
      return channel.eventLoop().newSucceededFuture(Boolean.FALSE);
    // We haven't marked it broken, so fallback to the default channel health checker.
    return ChannelHealthChecker.ACTIVE.isHealthy(channel);
  }
}

代码示例来源:origin: io.projectreactor.ipc/reactor-netty

@SuppressWarnings("unchecked")
Pool(Bootstrap bootstrap,
    PoolFactory provider,
    Consumer<? super Channel> onChannelCreate,
    EventLoopGroup group) {
  this.pool = provider.newPool(bootstrap, this, this);
  this.onChannelCreate = onChannelCreate;
  this.defaultGroup = group;
  HEALTHY = group.next()
          .newSucceededFuture(true);
  UNHEALTHY = group.next()
           .newSucceededFuture(false);
}

代码示例来源:origin: Nike-Inc/riposte

@Override
  public Future<Boolean> isHealthy(Channel channel) {
    // See if we've marked the channel as being non-usable first.
    if (channelIsMarkedAsBeingBroken(channel))
      return channel.eventLoop().newSucceededFuture(Boolean.FALSE);
    // We haven't marked it broken, so fallback to the default channel health checker.
    return ChannelHealthChecker.ACTIVE.isHealthy(channel);
  }
}

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

@SuppressWarnings("unchecked")
Pool(Bootstrap bootstrap,
    PoolFactory provider,
    ChannelOperations.OnSetup opsFactory) {
  this.bootstrap = bootstrap;
  this.opsFactory = opsFactory;
  this.pool = provider.newPool(bootstrap, this, this);
  this.defaultGroup = bootstrap.config()
                 .group();
  HEALTHY = defaultGroup.next()
             .newSucceededFuture(true);
  UNHEALTHY = defaultGroup.next()
              .newSucceededFuture(false);
}

代码示例来源:origin: io.projectreactor.netty/reactor-netty

@SuppressWarnings("unchecked")
Pool(Bootstrap bootstrap,
    PoolFactory provider,
    ChannelOperations.OnSetup opsFactory) {
  this.bootstrap = bootstrap;
  this.opsFactory = opsFactory;
  this.pool = provider.newPool(bootstrap, this, this);
  this.defaultGroup = bootstrap.config()
                 .group();
  HEALTHY = defaultGroup.next()
             .newSucceededFuture(true);
  UNHEALTHY = defaultGroup.next()
              .newSucceededFuture(false);
}

代码示例来源:origin: com.simplyti.cloud/simple-server-clients

private <T> Future<ClientRequestChannel<T>> clientRequestChannel(ClientConfig config, ClientRequestChannelInitializer<T> clientRequestChannelHandler, ChannelPool pool, Channel channel, Promise<T> resultPromise) {
  ClientRequestChannel<T> clientRequestChannel = new ClientRequestChannel<>(pool,channel,resultPromise);
  clientRequestChannelHandler.initialize(clientRequestChannel);
  addTracer(clientRequestChannel,config);
  EventLoop channelLoop = channel.eventLoop();
  if(ChannelClientInitHandler.isInitialized(channel)) {
    return channelLoop.newSucceededFuture(clientRequestChannel);
  }else {
    Promise<ClientRequestChannel<T>> clientPromise =  channelLoop.newPromise();
    if(channelLoop.inEventLoop()) {
      initialize(clientRequestChannel,clientPromise);
    }else {
      channelLoop.execute(()->initialize(clientRequestChannel,clientPromise));
    }
    return clientPromise;
  }
}

相关文章