Class BeanScheduler

  • Direct Known Subclasses:
    LifecycleManager, PlexusLifecycleManager

    public abstract class BeanScheduler
    extends java.lang.Object
    Schedules safe activation of beans even when cyclic dependencies are involved.
    Takes advantage of the new Guice ProvisionListener SPI, if available at runtime.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  BeanScheduler.CycleActivator
      Listens to provisioning events in order to determine safe activation points.
      private class  BeanScheduler.Pending
      Collects pending beans waiting for activation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.lang.Object CANDIDATE_CYCLE  
      (package private) static java.lang.Object CYCLE_ACTIVATOR  
      (package private) static java.lang.Object CYCLE_CONFIRMED  
      static com.google.inject.Module MODULE
      Enables deferred activation of component cycles, only needed in legacy systems like Plexus.
      (package private) static java.lang.ThreadLocal<java.lang.Object[]> pendingHolder  
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanScheduler()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void activate​(java.lang.Object bean)
      Customized activation of the given bean.
      static void detectCycle​(java.lang.Object value)
      Detects if a dependency cycle exists and activation needs to be deferred.
      void schedule​(java.lang.Object bean)
      Schedules activation of the given bean at the next safe activation point.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CYCLE_ACTIVATOR

        static final java.lang.Object CYCLE_ACTIVATOR
      • CANDIDATE_CYCLE

        static final java.lang.Object CANDIDATE_CYCLE
      • CYCLE_CONFIRMED

        static final java.lang.Object CYCLE_CONFIRMED
      • MODULE

        public static final com.google.inject.Module MODULE
        Enables deferred activation of component cycles, only needed in legacy systems like Plexus.
      • pendingHolder

        static final java.lang.ThreadLocal<java.lang.Object[]> pendingHolder
    • Constructor Detail

      • BeanScheduler

        public BeanScheduler()
    • Method Detail

      • detectCycle

        public static void detectCycle​(java.lang.Object value)
        Detects if a dependency cycle exists and activation needs to be deferred.
      • schedule

        public final void schedule​(java.lang.Object bean)
        Schedules activation of the given bean at the next safe activation point.
        Parameters:
        bean - The managed bean
      • activate

        protected abstract void activate​(java.lang.Object bean)
        Customized activation of the given bean.
        Parameters:
        bean - The bean to activate