T - the callback parameter typepublic final class MultipleRemoveListener<T> extends AbstractServiceListener<java.lang.Object>
| Modifier and Type | Class and Description |
|---|---|
static interface |
MultipleRemoveListener.Callback<T>
A generalized callback for when all services are removed.
|
| Modifier and Type | Field and Description |
|---|---|
private T |
attachment |
private MultipleRemoveListener.Callback<T> |
callback |
private int |
count |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> |
countUpdater |
private int |
done |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> |
doneUpdater |
private static MultipleRemoveListener.Callback<LifecycleContext> |
LIFECYCLE_CONTEXT_CALLBACK |
| Modifier | Constructor and Description |
|---|---|
private |
MultipleRemoveListener(MultipleRemoveListener.Callback<T> callback,
T attachment) |
| Modifier and Type | Method and Description |
|---|---|
static MultipleRemoveListener<LifecycleContext> |
create(LifecycleContext lifecycleContext)
Construct a new instance which calls the lifecycle
complete() method when done. |
static <T> MultipleRemoveListener<T> |
create(MultipleRemoveListener.Callback<T> callback,
T attachment)
Construct a new instance.
|
static MultipleRemoveListener<java.lang.Runnable> |
create(java.lang.Runnable task)
Construct a new instance.
|
void |
done()
Called when this listener has been added to all relevant services.
|
void |
listenerAdded(ServiceController<?> controller)
The listener has been added to a controller.
|
private void |
tick() |
void |
transition(ServiceController<? extends java.lang.Object> controller,
ServiceController.Transition transition)
The service has transitioned to a new sub-state.
|
dependencyFailed, dependencyFailureCleared, immediateDependencyAvailable, immediateDependencyUnavailable, serviceRemoveRequestCleared, serviceRemoveRequested, transitiveDependencyAvailable, transitiveDependencyUnavailableprivate volatile int count
private volatile int done
private final MultipleRemoveListener.Callback<T> callback
private final T attachment
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> countUpdater
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> doneUpdater
private static final MultipleRemoveListener.Callback<LifecycleContext> LIFECYCLE_CONTEXT_CALLBACK
private MultipleRemoveListener(MultipleRemoveListener.Callback<T> callback, T attachment)
public static <T> MultipleRemoveListener<T> create(MultipleRemoveListener.Callback<T> callback, T attachment)
T - the type of the attachmentcallback - the callback to invokeattachment - the attachment to pass to the callbackpublic static MultipleRemoveListener<java.lang.Runnable> create(java.lang.Runnable task)
task - the task to call upon completionpublic static MultipleRemoveListener<LifecycleContext> create(LifecycleContext lifecycleContext)
complete() method when done.lifecycleContext - the context to notifypublic void listenerAdded(ServiceController<?> controller)
listenerAdded in interface ServiceListener<java.lang.Object>listenerAdded in class AbstractServiceListener<java.lang.Object>controller - the controller that this listener was added topublic void transition(ServiceController<? extends java.lang.Object> controller, ServiceController.Transition transition)
AbstractServiceListenertransition in interface ServiceListener<java.lang.Object>transition in class AbstractServiceListener<java.lang.Object>controller - the controllertransition - the transition that occurredpublic void done()
private void tick()