Package org.jboss.msc.service
Class MultipleRemoveListener<T>
- java.lang.Object
-
- org.jboss.msc.service.AbstractServiceListener<java.lang.Object>
-
- org.jboss.msc.service.MultipleRemoveListener<T>
-
- Type Parameters:
T- the callback parameter type
- All Implemented Interfaces:
ServiceListener<java.lang.Object>
public final class MultipleRemoveListener<T> extends AbstractServiceListener<java.lang.Object>
A service listener which calls a callback once all of the services it was attached to have been removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMultipleRemoveListener.Callback<T>A generalized callback for when all services are removed.
-
Field Summary
Fields Modifier and Type Field Description private Tattachmentprivate MultipleRemoveListener.Callback<T>callbackprivate intcountprivate static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener>countUpdaterprivate intdoneprivate static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener>doneUpdaterprivate static MultipleRemoveListener.Callback<LifecycleContext>LIFECYCLE_CONTEXT_CALLBACK
-
Constructor Summary
Constructors Modifier Constructor Description privateMultipleRemoveListener(MultipleRemoveListener.Callback<T> callback, T attachment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultipleRemoveListener<java.lang.Runnable>create(java.lang.Runnable task)Construct a new instance.static MultipleRemoveListener<LifecycleContext>create(LifecycleContext lifecycleContext)Construct a new instance which calls the lifecyclecomplete()method when done.static <T> MultipleRemoveListener<T>create(MultipleRemoveListener.Callback<T> callback, T attachment)Construct a new instance.voiddone()Called when this listener has been added to all relevant services.voidlistenerAdded(ServiceController<?> controller)The listener has been added to a controller.private voidtick()voidtransition(ServiceController<? extends java.lang.Object> controller, ServiceController.Transition transition)The service has transitioned to a new sub-state.-
Methods inherited from class org.jboss.msc.service.AbstractServiceListener
dependencyFailed, dependencyFailureCleared, immediateDependencyAvailable, immediateDependencyUnavailable, serviceRemoveRequestCleared, serviceRemoveRequested, transitiveDependencyAvailable, transitiveDependencyUnavailable
-
-
-
-
Field Detail
-
count
private volatile int count
-
done
private volatile int done
-
callback
private final MultipleRemoveListener.Callback<T> callback
-
attachment
private final T attachment
-
countUpdater
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> countUpdater
-
doneUpdater
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<MultipleRemoveListener> doneUpdater
-
LIFECYCLE_CONTEXT_CALLBACK
private static final MultipleRemoveListener.Callback<LifecycleContext> LIFECYCLE_CONTEXT_CALLBACK
-
-
Constructor Detail
-
MultipleRemoveListener
private MultipleRemoveListener(MultipleRemoveListener.Callback<T> callback, T attachment)
-
-
Method Detail
-
create
public static <T> MultipleRemoveListener<T> create(MultipleRemoveListener.Callback<T> callback, T attachment)
Construct a new instance.- Type Parameters:
T- the type of the attachment- Parameters:
callback- the callback to invokeattachment- the attachment to pass to the callback- Returns:
- the remove listener
-
create
public static MultipleRemoveListener<java.lang.Runnable> create(java.lang.Runnable task)
Construct a new instance.- Parameters:
task- the task to call upon completion- Returns:
- the remove listener
-
create
public static MultipleRemoveListener<LifecycleContext> create(LifecycleContext lifecycleContext)
Construct a new instance which calls the lifecyclecomplete()method when done.- Parameters:
lifecycleContext- the context to notify- Returns:
- the remove listener
-
listenerAdded
public void listenerAdded(ServiceController<?> controller)
The listener has been added to a controller.- Specified by:
listenerAddedin interfaceServiceListener<T>- Overrides:
listenerAddedin classAbstractServiceListener<java.lang.Object>- Parameters:
controller- the controller that this listener was added to
-
transition
public void transition(ServiceController<? extends java.lang.Object> controller, ServiceController.Transition transition)
Description copied from class:AbstractServiceListenerThe service has transitioned to a new sub-state.- Specified by:
transitionin interfaceServiceListener<T>- Overrides:
transitionin classAbstractServiceListener<java.lang.Object>- Parameters:
controller- the controllertransition- the transition that occurred
-
done
public void done()
Called when this listener has been added to all relevant services.
-
tick
private void tick()
-
-