Class LifeCycleCallbackCollection

java.lang.Object
org.eclipse.jetty.plus.annotation.LifeCycleCallbackCollection

public class LifeCycleCallbackCollection extends Object
LifeCycleCallbackCollection This class collects the classes and methods that have been configured in web.xml with postconstruct/predestroy callbacks, or that contain the equivalent annotations. It is also responsible for calling the callbacks. This class is not threadsafe for concurrent modifications, but is threadsafe for reading with concurrent modifications.
  • Field Details

  • Constructor Details

    • LifeCycleCallbackCollection

      public LifeCycleCallbackCollection()
  • Method Details

    • add

      public void add(LifeCycleCallback callback)
      Add a Callback to the list of callbacks.
      Parameters:
      callback - the callback
    • getPreDestroyCallbacks

      public Set<LifeCycleCallback> getPreDestroyCallbacks(Object o)
    • getPreDestroyCallbacks

      public Collection<LifeCycleCallback> getPreDestroyCallbacks()
      Amalgamate all pre-destroy callbacks and return a read only set
      Returns:
      the collection of PreDestroyCallbacks
    • getPostConstructCallbacks

      public Set<LifeCycleCallback> getPostConstructCallbacks(Object o)
    • getPostConstructCallbacks

      public Collection<LifeCycleCallback> getPostConstructCallbacks()
      Amalgamate all post-construct callbacks and return a read only set
      Returns:
      the collection of PostConstructCallbacks
    • callPostConstructCallback

      public void callPostConstructCallback(Object o) throws Exception
      Call the method, if one exists, that is annotated with @PostConstruct or with <post-construct> in web.xml
      Parameters:
      o - the object on which to attempt the callback
      Throws:
      Exception - if unable to call PostConstructCallback
    • callPreDestroyCallback

      public void callPreDestroyCallback(Object o) throws Exception
      Call the method, if one exists, that is annotated with @PreDestroy or with <pre-destroy> in web.xml
      Parameters:
      o - the object on which to attempt the callback
      Throws:
      Exception - if unable to call PreDestroyCallback
    • getPostConstructCallbackMap

      public Map<String,Set<LifeCycleCallback>> getPostConstructCallbackMap()
      Generate a read-only view of the post-construct callbacks
      Returns:
      the map of PostConstructCallbacks
    • getPreDestroyCallbackMap

      public Map<String,Set<LifeCycleCallback>> getPreDestroyCallbackMap()
      Generate a read-only view of the pre-destroy callbacks
      Returns:
      the map of PreDestroyCallbacks