Class RefreshScope

  • All Implemented Interfaces:
    io.micronaut.context.event.ApplicationEventListener<RefreshEvent>, io.micronaut.context.LifeCycle<RefreshScope>, io.micronaut.context.scope.CustomScope<Refreshable>, io.micronaut.core.order.Ordered, java.io.Closeable, java.lang.AutoCloseable, java.util.EventListener

    @Singleton
    @Requires(notEnv={"function","android"})
    public class RefreshScope
    extends java.lang.Object
    implements io.micronaut.context.scope.CustomScope<Refreshable>, io.micronaut.context.LifeCycle<RefreshScope>, io.micronaut.context.event.ApplicationEventListener<RefreshEvent>, io.micronaut.core.order.Ordered
    Implementation of Refreshable.
    Since:
    1.0
    See Also:
    Refreshable, RefreshEvent
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int POSITION  
      • Fields inherited from interface io.micronaut.core.order.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Constructor Summary

      Constructors 
      Constructor Description
      RefreshScope​(io.micronaut.context.BeanContext beanContext)  
      RefreshScope​(io.micronaut.context.BeanContext beanContext, java.util.concurrent.Executor executorService)
      Deprecated.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<Refreshable> annotationType()  
      <T> java.util.Optional<io.micronaut.context.BeanRegistration<T>> findBeanRegistration​(T bean)  
      protected java.util.concurrent.locks.ReadWriteLock getLock​(java.lang.Object object)  
      <T> T getOrCreate​(io.micronaut.context.scope.BeanCreationContext<T> creationContext)  
      int getOrder()  
      boolean isRunning()  
      void onApplicationEvent​(RefreshEvent event)  
      void onRefreshEvent​(RefreshEvent event)
      Handle a RefreshEvent synchronously.
      <T> java.util.Optional<T> remove​(io.micronaut.inject.BeanIdentifier identifier)  
      RefreshScope stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.micronaut.context.event.ApplicationEventListener

        supports
      • Methods inherited from interface io.micronaut.context.scope.CustomScope

        findBeanRegistration
      • Methods inherited from interface io.micronaut.context.LifeCycle

        close, refresh, start
    • Constructor Detail

      • RefreshScope

        @Deprecated
        public RefreshScope​(io.micronaut.context.BeanContext beanContext,
                            @Named("io")
                            java.util.concurrent.Executor executorService)
        Deprecated.
        Parameters:
        beanContext - The bean context to allow DI of beans annotated with @Inject
        executorService - The executor service
      • RefreshScope

        @Inject
        public RefreshScope​(io.micronaut.context.BeanContext beanContext)
        Parameters:
        beanContext - The bean context to allow DI of beans annotated with @Inject
    • Method Detail

      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface io.micronaut.context.LifeCycle<RefreshScope>
      • annotationType

        public java.lang.Class<Refreshable> annotationType()
        Specified by:
        annotationType in interface io.micronaut.context.scope.CustomScope<Refreshable>
      • getOrCreate

        public <T> T getOrCreate​(io.micronaut.context.scope.BeanCreationContext<T> creationContext)
        Specified by:
        getOrCreate in interface io.micronaut.context.scope.CustomScope<Refreshable>
      • remove

        public <T> java.util.Optional<T> remove​(io.micronaut.inject.BeanIdentifier identifier)
        Specified by:
        remove in interface io.micronaut.context.scope.CustomScope<Refreshable>
      • onApplicationEvent

        public void onApplicationEvent​(RefreshEvent event)
        Specified by:
        onApplicationEvent in interface io.micronaut.context.event.ApplicationEventListener<RefreshEvent>
      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface io.micronaut.core.order.Ordered
      • findBeanRegistration

        public <T> java.util.Optional<io.micronaut.context.BeanRegistration<T>> findBeanRegistration​(T bean)
        Specified by:
        findBeanRegistration in interface io.micronaut.context.scope.CustomScope<Refreshable>
      • getLock

        protected java.util.concurrent.locks.ReadWriteLock getLock​(java.lang.Object object)
        Parameters:
        object - The bean
        Returns:
        The lock on the object