public class ComponentUtils extends Object
| Constructor and Description |
|---|
ComponentUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
offerUntilSuccess(T entry,
Queue<T> queue)
Certain types of queues will fail to
Queue.offer(Object) an item due to many factors
depending on the type of queue. |
static <T> T |
pollWhileNotEmpty(Queue<T> queue)
Certain types of queues will return null when calling
Queue.poll() due to many factors depending
on the type of queue. |
static <V> void |
registerLocalMBean(String name,
V mbean)
Attempts to register an object with local MBeanServer.
|
static void |
removeAllMBeansOfDomain(String domain)
Removes all mbeans registered undered a specific domain.
|
static void |
shutdownExecutor(ExecutorService stream,
int initialWait,
int secondaryWait)
Attempts to safely
ExecutorService.shutdown()
and ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
of an ExecutorService. |
public static <T> void offerUntilSuccess(T entry,
Queue<T> queue)
Queue.offer(Object) an item due to many factors
depending on the type of queue. offerUntilSuccess will not return until the item has been
successfully queued onto the desired queueT - typeentry - item to queuequeue - queue to add the entry topublic static <T> T pollWhileNotEmpty(Queue<T> queue)
Queue.poll() due to many factors depending
on the type of queue. pollWhileNotEmpty will poll the queue until an item from the queue is returned
or the queue is empty. If the queue is empty it will return NULL.T - typequeue - queue to read the entry frompublic static void shutdownExecutor(ExecutorService stream, int initialWait, int secondaryWait)
ExecutorService.shutdown()
and ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
of an ExecutorService.stream - service to be shutdowninitialWait - time in seconds to wait for currently running threads to finish executionsecondaryWait - time in seconds to wait for running threads that did not terminate to acknowledge their forced terminationpublic static void removeAllMBeansOfDomain(String domain) throws Exception
domain - mbean domainExceptionpublic static <V> void registerLocalMBean(String name, V mbean)
name - name to register bean withmbean - mbean to registerCopyright © 2020 The Apache Software Foundation. All rights reserved.