@Singleton @Requires(notEnv={"function","android"}) public class RefreshScope extends Object implements CustomScope<Refreshable>, LifeCycle<RefreshScope>, ApplicationEventListener<RefreshEvent>, Ordered
Refreshable
.Refreshable
,
RefreshEvent
Modifier and Type | Field and Description |
---|---|
static int |
POSITION |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
RefreshScope(BeanContext beanContext) |
RefreshScope(BeanContext beanContext,
Executor executorService)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Class<Refreshable> |
annotationType() |
<T> Optional<BeanRegistration<T>> |
findBeanRegistration(T bean)
Get the
BeanDefinition for the given bean. |
protected ReadWriteLock |
getLock(Object object) |
<T> T |
getOrCreate(BeanCreationContext<T> creationContext)
Resolve an object from the given scope.
|
int |
getOrder() |
boolean |
isRunning() |
void |
onApplicationEvent(RefreshEvent event)
Handle an application event.
|
void |
onRefreshEvent(RefreshEvent event)
Handle a
RefreshEvent synchronously. |
<T> Optional<T> |
remove(BeanIdentifier identifier)
Remove a bean definition from the scope.
|
RefreshScope |
stop()
Stops the life cycle component.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findBeanRegistration
supports
public static final int POSITION
@Deprecated public RefreshScope(BeanContext beanContext, @Named(value="io") Executor executorService)
beanContext
- The bean context to allow DI of beans annotated with @InjectexecutorService
- The executor service@Inject public RefreshScope(BeanContext beanContext)
beanContext
- The bean context to allow DI of beans annotated with @Injectpublic boolean isRunning()
isRunning
in interface LifeCycle<RefreshScope>
public Class<Refreshable> annotationType()
annotationType
in interface CustomScope<Refreshable>
public <T> T getOrCreate(BeanCreationContext<T> creationContext)
CustomScope
getOrCreate
in interface CustomScope<Refreshable>
T
- The bean generic typecreationContext
- The creation contextpublic RefreshScope stop()
LifeCycle
stop
in interface LifeCycle<RefreshScope>
public <T> Optional<T> remove(BeanIdentifier identifier)
CustomScope
remove
in interface CustomScope<Refreshable>
T
- The generic typeidentifier
- The BeanIdentifier
Optional
of the instance that was destroyed if it existspublic void onApplicationEvent(RefreshEvent event)
ApplicationEventListener
onApplicationEvent
in interface ApplicationEventListener<RefreshEvent>
event
- the event to respond topublic final void onRefreshEvent(RefreshEvent event)
RefreshEvent
synchronously. This method blocks unlike onApplicationEvent(RefreshEvent)
.event
- The eventpublic int getOrder()
public <T> Optional<BeanRegistration<T>> findBeanRegistration(T bean)
CustomScope
BeanDefinition
for the given bean.findBeanRegistration
in interface CustomScope<Refreshable>
T
- The bean generic typebean
- The beanprotected ReadWriteLock getLock(Object object)
object
- The bean