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,Closeable,AutoCloseable,EventListener
@Singleton
@Requires(condition=RefreshScopeCondition.class)
public class RefreshScope
extends 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:
-
Field Summary
FieldsFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Optional<io.micronaut.context.BeanRegistration<T>>findBeanRegistration(T bean) protected ReadWriteLock<T> TgetOrCreate(io.micronaut.context.scope.BeanCreationContext<T> creationContext) intgetOrder()booleanvoidonApplicationEvent(RefreshEvent event) final voidonRefreshEvent(RefreshEvent event) Handle aRefreshEventsynchronously.<T> Optional<T>remove(io.micronaut.inject.BeanIdentifier identifier) stop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.event.ApplicationEventListener
supportsMethods inherited from interface io.micronaut.context.scope.CustomScope
findBeanRegistrationMethods inherited from interface io.micronaut.context.LifeCycle
close, refresh, start
-
Field Details
-
POSITION
public static final int POSITION- See Also:
-
-
Constructor Details
-
RefreshScope
public RefreshScope(io.micronaut.context.BeanContext beanContext) - Parameters:
beanContext- The bean context to allow DI of beans annotated with @Inject
-
-
Method Details
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
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
- Specified by:
stopin interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
remove
- Specified by:
removein interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceio.micronaut.context.event.ApplicationEventListener<RefreshEvent>
-
onRefreshEvent
Handle aRefreshEventsynchronously. This method blocks unlikeonApplicationEvent(RefreshEvent).- Parameters:
event- The event
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-
findBeanRegistration
- Specified by:
findBeanRegistrationin interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
getLock
- Parameters:
object- The bean- Returns:
- The lock on the object
-