Package org.jgroups.util
Class AsyncExecutor<T>
- java.lang.Object
-
- org.jgroups.util.AsyncExecutor<T>
-
- All Implemented Interfaces:
Lifecycle
public class AsyncExecutor<T> extends java.lang.Object implements Lifecycle
Used to execute asynchronous tasks, e.g. async-send (https://issues.redhat.com/browse/JGRP-2603). Uses a blockng queue and a dequeuer thread, which passes removed tasks to the thread pool- Since:
- 5.3.5
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AsyncExecutor.Task<T>
-
Field Summary
Fields Modifier and Type Field Description protected boolean
enabled
protected java.util.concurrent.Executor
executor
protected java.util.concurrent.atomic.LongAdder
num_drops_on_full_thread_pool
protected java.util.concurrent.atomic.LongAdder
num_rejected
protected java.util.concurrent.atomic.LongAdder
num_sends
protected java.util.concurrent.atomic.LongAdder
num_sends_on_callers_thread
protected ThreadPool
thread_pool
-
Constructor Summary
Constructors Constructor Description AsyncExecutor()
AsyncExecutor(ThreadPool p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncExecutor<T>
enable(boolean b)
boolean
enabled()
protected java.util.concurrent.Executor
exec()
java.util.concurrent.CompletableFuture<T>
execute(java.util.function.Supplier<T> t, boolean can_be_dropped)
long
numDropsOnFullThreadPool()
long
numRejected()
long
numSends()
long
numSendsOnCallersThread()
void
resetStats()
ThreadPool
threadPool()
AsyncExecutor<T>
threadPool(ThreadPool p)
java.lang.String
toString()
-
-
-
Field Detail
-
enabled
protected boolean enabled
-
num_sends
protected final java.util.concurrent.atomic.LongAdder num_sends
-
num_rejected
protected final java.util.concurrent.atomic.LongAdder num_rejected
-
num_drops_on_full_thread_pool
protected final java.util.concurrent.atomic.LongAdder num_drops_on_full_thread_pool
-
num_sends_on_callers_thread
protected final java.util.concurrent.atomic.LongAdder num_sends_on_callers_thread
-
thread_pool
protected ThreadPool thread_pool
-
executor
protected java.util.concurrent.Executor executor
-
-
Constructor Detail
-
AsyncExecutor
public AsyncExecutor()
-
AsyncExecutor
public AsyncExecutor(ThreadPool p)
-
-
Method Detail
-
enabled
public boolean enabled()
-
enable
public AsyncExecutor<T> enable(boolean b)
-
threadPool
public ThreadPool threadPool()
-
threadPool
public AsyncExecutor<T> threadPool(ThreadPool p)
-
numSends
public long numSends()
-
numSendsOnCallersThread
public long numSendsOnCallersThread()
-
numDropsOnFullThreadPool
public long numDropsOnFullThreadPool()
-
numRejected
public long numRejected()
-
resetStats
public void resetStats()
-
execute
public java.util.concurrent.CompletableFuture<T> execute(java.util.function.Supplier<T> t, boolean can_be_dropped)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
exec
protected java.util.concurrent.Executor exec()
-
-