@Override public EventLoop next() { return delegate.next(); }
private static EventLoop getEventLoop(VertxInternal vertx) { EventLoopGroup group = vertx.getEventLoopGroup(); if (group != null) { return group.next(); } else { return null; } }
final EventLoop eventLoop() { if (eventLoop != null) { return eventLoop; } else { return CommonPools.workerGroup().next(); } }
/** * Returns the {@link EventLoop} that handles the request. */ protected final EventLoop eventLoop() { if (eventLoop == null) { eventLoop = CommonPools.workerGroup().next(); } return eventLoop; }
/** * Returns the {@link EventLoop}. */ public EventLoop get() { return group().next(); } }
@Override public EventLoop next() { final EventLoop thisEventLoop = self.get(); return null != thisEventLoop ? thisEventLoop : delegate.next(); }
@Override public Worker createWorker() { final EventLoop eventLoop = eventLoopGroup.next(); return new EventloopWorker(eventLoop); }
public PersistentAcknowledgmentsGroupingTracker(ConsumerImpl<?> consumer, ConsumerConfigurationData<?> conf, EventLoopGroup eventLoopGroup) { this.consumer = consumer; this.pendingIndividualAcks = new ConcurrentSkipListSet<>(); this.acknowledgementGroupTimeMicros = conf.getAcknowledgementsGroupTimeMicros(); if (acknowledgementGroupTimeMicros > 0) { scheduledTask = eventLoopGroup.next().scheduleWithFixedDelay(this::flush, acknowledgementGroupTimeMicros, acknowledgementGroupTimeMicros, TimeUnit.MICROSECONDS); } else { scheduledTask = null; } }
/** * Returns the default {@link EventExecutor} which will be used when a user subscribes using * {@link #subscribe(Subscriber)} or {@link #subscribe(Subscriber, boolean)}. */ protected EventExecutor defaultSubscriberExecutor() { return RequestContext.mapCurrent(RequestContext::eventLoop, () -> CommonPools.workerGroup().next()); }
/** * Returns a {@link EventLoop} from the worker group. This can be used for, e.g., scheduling background * tasks for the lifetime of the {@link Server} using * {@link EventLoop#scheduleAtFixedRate(Runnable, long, long, TimeUnit)}. It is very important that these * tasks do not block as this would block all requests in the server on that {@link EventLoop}. */ public EventLoop nextEventLoop() { return config().workerGroup().next(); }
/** * Returns the default {@link EventExecutor} which will be used when a user subscribes using * {@link #subscribe(Subscriber)} or {@link #subscribe(Subscriber, boolean)}. */ protected EventExecutor defaultSubscriberExecutor() { return RequestContext.mapCurrent(RequestContext::eventLoop, () -> CommonPools.workerGroup().next()); }
@Override public final Future<Channel> acquire() { return acquire(bootstrap.config().group().next().<Channel>newPromise()); }
public DNSMonitor(ConnectionManager connectionManager, RedisClient masterHost, Collection<URI> slaveHosts, long dnsMonitoringInterval, AddressResolverGroup<InetSocketAddress> resolverGroup) { this.resolver = resolverGroup.getResolver(connectionManager.getGroup().next()); masterHost.resolveAddr().syncUninterruptibly(); masters.put(masterHost.getConfig().getAddress(), masterHost.getAddr()); for (URI host : slaveHosts) { Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(host.getHost(), host.getPort())); resolveFuture.syncUninterruptibly(); slaves.put(host, resolveFuture.getNow()); } this.connectionManager = connectionManager; this.dnsMonitoringInterval = dnsMonitoringInterval; }
public DNSMonitor(ConnectionManager connectionManager, RedisClient masterHost, Collection<URI> slaveHosts, long dnsMonitoringInterval, AddressResolverGroup<InetSocketAddress> resolverGroup) { this.resolver = resolverGroup.getResolver(connectionManager.getGroup().next()); masterHost.resolveAddr().syncUninterruptibly(); masters.put(masterHost.getConfig().getAddress(), masterHost.getAddr()); for (URI host : slaveHosts) { Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(host.getHost(), host.getPort())); resolveFuture.syncUninterruptibly(); slaves.put(host, resolveFuture.getNow()); } this.connectionManager = connectionManager; this.dnsMonitoringInterval = dnsMonitoringInterval; }
AddressResolver<InetSocketAddress> resolver = (AddressResolver<InetSocketAddress>) bootstrap.config().resolver().getResolver(bootstrap.config().group().next()); Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort())); resolveFuture.addListener(new FutureListener<InetSocketAddress>() {
AddressResolver<InetSocketAddress> resolver = (AddressResolver<InetSocketAddress>) bootstrap.config().resolver().getResolver(bootstrap.config().group().next()); Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort())); resolveFuture.addListener(new FutureListener<InetSocketAddress>() {
@Override public final Future<Channel> acquire() { return acquire(bootstrap.config().group().next().<Channel>newPromise()); }
@Override public final Future<Channel> acquire() { return acquire(bootstrap.config().group().next().<Channel>newPromise()); }
channels = new DefaultChannelGroup(copy.getGroup().next()); bootstrap = createBootstrap(copy, Type.PLAIN); pubSubBootstrap = createBootstrap(copy, Type.PUBSUB);
@Test public void testInitialization() { assertSame(vertx, ((FakeVertxMetrics)FakeMetricsBase.getMetrics(vertx)).vertx()); startNodes(1); assertSame(vertices[0], ((FakeVertxMetrics)FakeMetricsBase.getMetrics(vertices[0])).vertx()); EventLoopGroup group = vertx.nettyEventLoopGroup(); Set<EventLoop> loops = new HashSet<>(); int count = 0; while (true) { EventLoop next = group.next(); if (!loops.add(next)) { break; } count++; assertTrue(count <= VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE); } assertEquals(loops.size(), VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE); } }