@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public <V> Future<V> newSucceededFuture(V result) { return new RequestContextAwareFuture<>(context(), delegate().newSucceededFuture(result)); }
.newSucceededFuture(null); queriesInProgress.add(resolveFuture);
.newSucceededFuture(null); queriesInProgress.add(resolveFuture);
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@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); } } };
@Override public <V> Future<V> newSucceededFuture(V arg0) { return getDelegate().newSucceededFuture(arg0); }
@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); } }
@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); } }
@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); }
@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); } }
@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); }
@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); }
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; } }