Class ShutdownAwareScope

  • All Implemented Interfaces:
    Scope

    public abstract class ShutdownAwareScope
    extends java.lang.Object
    implements Scope
    Base Scope class for scopes that collect destroyable beans and implement shutdown routine.
    • Field Detail

      • destroyableBeans

        protected java.util.List<BeanData> destroyableBeans
    • Constructor Detail

      • ShutdownAwareScope

        public ShutdownAwareScope()
    • Method Detail

      • isBeanDestroyable

        protected boolean isBeanDestroyable​(BeanData beanData)
        Returns true if bean is destroyable.
      • registerDestroyableBeans

        protected void registerDestroyableBeans​(BeanData beanData)
        Checks if bean data is destroyable (has destroy methods) and registers it for later shutdown().
      • totalRegisteredDestroyableBeans

        protected int totalRegisteredDestroyableBeans()
        Returns number of destroyable beans that have been registered.
      • destroyBean

        protected void destroyBean​(BeanData beanData)
        Removes destroyable bean from the list and calls it destroy methods. If bean is not destroyable, does nothing. Bean gets destroyed only once.
      • shutdown

        public void shutdown()
        Shutdowns the scope and calls all collected destroyable beans.
        Specified by:
        shutdown in interface Scope