public class CallbacksDispatcher<L> extends Object implements Closeable
#execCallbacks(CallbackFactory) method.| Modifier and Type | Class and Description |
|---|---|
class |
CallbacksDispatcher.CallbackCallable<R> |
static class |
CallbacksDispatcher.CallbackResults<L,R> |
| Constructor and Description |
|---|
CallbacksDispatcher() |
CallbacksDispatcher(ExecutorService execService,
org.slf4j.Logger log) |
CallbacksDispatcher(org.slf4j.Logger log) |
CallbacksDispatcher(com.google.common.base.Optional<ExecutorService> execService,
com.google.common.base.Optional<org.slf4j.Logger> log)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(L listener) |
void |
addWeakListener(L listener)
Only weak references are stored for weak listeners.
|
void |
close() |
<R> CallbacksDispatcher.CallbackResults<L,R> |
execCallbacks(com.google.common.base.Function<? super L,R> callback) |
<R> CallbacksDispatcher.CallbackResults<L,R> |
execCallbacks(com.google.common.base.Function<? super L,R> callback,
L listener) |
static ExecutorService |
getDefaultExecutor(org.slf4j.Logger log) |
List<L> |
getListeners() |
org.slf4j.Logger |
getLog() |
void |
removeListener(L listener) |
public CallbacksDispatcher(com.google.common.base.Optional<ExecutorService> execService, com.google.common.base.Optional<org.slf4j.Logger> log)
execService - optional executor services for the callbacks; if none is specified, a
single-thread executor will be usedlog - optional logger; if none is specified, a default one will be createdpublic CallbacksDispatcher()
public CallbacksDispatcher(org.slf4j.Logger log)
public CallbacksDispatcher(ExecutorService execService, org.slf4j.Logger log)
public static ExecutorService getDefaultExecutor(org.slf4j.Logger log)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void addListener(L listener)
public void addWeakListener(L listener)
public void removeListener(L listener)
public org.slf4j.Logger getLog()
public <R> CallbacksDispatcher.CallbackResults<L,R> execCallbacks(com.google.common.base.Function<? super L,R> callback, L listener) throws InterruptedException
InterruptedExceptionpublic <R> CallbacksDispatcher.CallbackResults<L,R> execCallbacks(com.google.common.base.Function<? super L,R> callback) throws InterruptedException
InterruptedException