io.netty.util.concurrent.SingleThreadEventExecutor Java Examples
The following examples show how to use
io.netty.util.concurrent.SingleThreadEventExecutor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NettyQueuesMetricsInitializer.java From gruffalo with Apache License 2.0 | 6 votes |
public NettyQueuesMetricsInitializer(final MetricFactory metricFactory, final EventLoopGroup elg) { if (metricFactory == null || elg == null) { return; } int index = 0; for (final EventExecutor eventExecutor : elg) { if (eventExecutor instanceof SingleThreadEventExecutor) { final SingleThreadEventExecutor singleExecutor = (SingleThreadEventExecutor) eventExecutor; metricFactory.registerGauge("GruffaloEventLoopGroup", "EventLoop-" + index, new Gauge<Integer>() { @Override public Integer getValue() { return singleExecutor.pendingTasks(); } }); index++; } } }
Example #2
Source File: VertxPeerDiscoveryAgent.java From besu with Apache License 2.0 | 5 votes |
private IntSupplier pendingTaskCounter(final EventLoopGroup eventLoopGroup) { return () -> StreamSupport.stream(eventLoopGroup.spliterator(), false) .filter(eventExecutor -> eventExecutor instanceof SingleThreadEventExecutor) .mapToInt(eventExecutor -> ((SingleThreadEventExecutor) eventExecutor).pendingTasks()) .sum(); }
Example #3
Source File: NettyConnectionInitializer.java From besu with Apache License 2.0 | 5 votes |
private IntSupplier pendingTaskCounter(final EventLoopGroup eventLoopGroup) { return () -> StreamSupport.stream(eventLoopGroup.spliterator(), false) .filter(eventExecutor -> eventExecutor instanceof SingleThreadEventExecutor) .mapToInt(eventExecutor -> ((SingleThreadEventExecutor) eventExecutor).pendingTasks()) .sum(); }
Example #4
Source File: VirtualChannel.java From quarkus with Apache License 2.0 | 5 votes |
@Override protected void doRegister() throws Exception { // Check if both peer and parent are non-null because this channel was created by a LocalServerChannel. // This is needed as a peer may not be null also if a LocalChannel was connected before and // deregistered / registered later again. // // See https://github.com/netty/netty/issues/2400 if (parent() != null) { // Store the peer in a local variable as it may be set to null if doClose() is called. // See https://github.com/netty/netty/issues/2144 state = State.CONNECTED; } ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook); }
Example #5
Source File: NettyQueuesGaugeBuilder.java From ob1k with Apache License 2.0 | 5 votes |
public static void registerQueueGauges(final MetricFactory factory, final EventLoopGroup elg, final String componentName) { if (factory == null || elg == null) { return; } int index = 0; for (final EventExecutor eventExecutor : elg) { if (eventExecutor instanceof SingleThreadEventExecutor) { final SingleThreadEventExecutor singleExecutor = (SingleThreadEventExecutor) eventExecutor; factory.registerGauge("EventLoopGroup-" + componentName, "EventLoop-" + index, singleExecutor::pendingTasks); index++; } } }
Example #6
Source File: LocalChannel.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { // Just remove the shutdownHook as this Channel may be closed later or registered to another EventLoop ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }
Example #7
Source File: LocalServerChannel.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override protected void doRegister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook); }
Example #8
Source File: LocalServerChannel.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }
Example #9
Source File: VirtualChannel.java From quarkus with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { // Just remove the shutdownHook as this Channel may be closed later or registered to another EventLoop ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }
Example #10
Source File: VirtualServerChannel.java From quarkus with Apache License 2.0 | 4 votes |
@Override protected void doRegister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook); }
Example #11
Source File: VirtualServerChannel.java From quarkus with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }
Example #12
Source File: LocalChannel.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { // Just remove the shutdownHook as this Channel may be closed later or registered to another EventLoop ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }
Example #13
Source File: LocalServerChannel.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected void doRegister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).addShutdownHook(shutdownHook); }
Example #14
Source File: LocalServerChannel.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected void doDeregister() throws Exception { ((SingleThreadEventExecutor) eventLoop()).removeShutdownHook(shutdownHook); }