Class RefreshScope
- java.lang.Object
-
- io.micronaut.runtime.context.scope.refresh.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.OrderedImplementation ofRefreshable.- Since:
- 1.0
- See Also:
Refreshable,RefreshEvent
-
-
Field Summary
Fields Modifier and Type Field Description static intPOSITION
-
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.ReadWriteLockgetLock(java.lang.Object object)<T> TgetOrCreate(io.micronaut.context.scope.BeanCreationContext<T> creationContext)intgetOrder()booleanisRunning()voidonApplicationEvent(RefreshEvent event)voidonRefreshEvent(RefreshEvent event)Handle aRefreshEventsynchronously.<T> java.util.Optional<T>remove(io.micronaut.inject.BeanIdentifier identifier)RefreshScopestop()
-
-
-
Field Detail
-
POSITION
public static final int POSITION
- See Also:
- Constant Field Values
-
-
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 @InjectexecutorService- 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:
isRunningin interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
annotationType
public java.lang.Class<Refreshable> annotationType()
- Specified by:
annotationTypein interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
getOrCreate
public <T> T getOrCreate(io.micronaut.context.scope.BeanCreationContext<T> creationContext)
- Specified by:
getOrCreatein interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
stop
public RefreshScope stop()
- Specified by:
stopin interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
remove
public <T> java.util.Optional<T> remove(io.micronaut.inject.BeanIdentifier identifier)
- Specified by:
removein interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
onApplicationEvent
public void onApplicationEvent(RefreshEvent event)
- Specified by:
onApplicationEventin interfaceio.micronaut.context.event.ApplicationEventListener<RefreshEvent>
-
onRefreshEvent
public final void onRefreshEvent(RefreshEvent event)
Handle aRefreshEventsynchronously. This method blocks unlikeonApplicationEvent(RefreshEvent).- Parameters:
event- The event
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-
findBeanRegistration
public <T> java.util.Optional<io.micronaut.context.BeanRegistration<T>> findBeanRegistration(T bean)
- Specified by:
findBeanRegistrationin interfaceio.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
-
-