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.Ordered
Implementation ofRefreshable
.- Since:
- 1.0
- See Also:
Refreshable
,RefreshEvent
-
-
Field Summary
Fields Modifier and Type Field Description static int
POSITION
-
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 aRefreshEvent
synchronously.<T> java.util.Optional<T>
remove(io.micronaut.inject.BeanIdentifier identifier)
RefreshScope
stop()
-
-
-
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:
isRunning
in interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
annotationType
public java.lang.Class<Refreshable> annotationType()
- Specified by:
annotationType
in interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
getOrCreate
public <T> T getOrCreate(io.micronaut.context.scope.BeanCreationContext<T> creationContext)
- Specified by:
getOrCreate
in interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
stop
public RefreshScope stop()
- Specified by:
stop
in interfaceio.micronaut.context.LifeCycle<RefreshScope>
-
remove
public <T> java.util.Optional<T> remove(io.micronaut.inject.BeanIdentifier identifier)
- Specified by:
remove
in interfaceio.micronaut.context.scope.CustomScope<Refreshable>
-
onApplicationEvent
public void onApplicationEvent(RefreshEvent event)
- Specified by:
onApplicationEvent
in interfaceio.micronaut.context.event.ApplicationEventListener<RefreshEvent>
-
onRefreshEvent
public final void onRefreshEvent(RefreshEvent event)
Handle aRefreshEvent
synchronously. This method blocks unlikeonApplicationEvent(RefreshEvent)
.- Parameters:
event
- The event
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceio.micronaut.core.order.Ordered
-
findBeanRegistration
public <T> java.util.Optional<io.micronaut.context.BeanRegistration<T>> findBeanRegistration(T bean)
- Specified by:
findBeanRegistration
in 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
-
-