JBoss Modular Service Kernel API 1.0.0.CR2

org.jboss.msc.service
Class MultipleRemoveListener<T>

java.lang.Object
  extended by org.jboss.msc.service.AbstractServiceListener<java.lang.Object>
      extended by 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.

Author:
David M. Lloyd

Nested Class Summary
static interface MultipleRemoveListener.Callback<T>
          A generalized callback for when all services are removed.
 
Nested classes/interfaces inherited from interface org.jboss.msc.service.ServiceListener
ServiceListener.Inheritance
 
Method Summary
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.
 void transition(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 invoke
attachment - 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 lifecycle complete() 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:
listenerAdded in interface ServiceListener<java.lang.Object>
Overrides:
listenerAdded in class AbstractServiceListener<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: AbstractServiceListener
The service has transitioned to a new sub-state.

Specified by:
transition in interface ServiceListener<java.lang.Object>
Overrides:
transition in class AbstractServiceListener<java.lang.Object>
Parameters:
controller - the controller
transition - the transition that occurred

done

public void done()
Called when this listener has been added to all relevant services.


JBoss Modular Service Kernel API 1.0.0.CR2

Copyright © 2011 JBoss, a division of Red Hat, Inc.