@Singleton @Requires(notEnv={"function","android"}) public class RefreshScope extends Object implements CustomScope<Refreshable>, LifeCycle<RefreshScope>, ApplicationEventListener<RefreshEvent>
Refreshable.Refreshable,
RefreshEvent| Constructor and Description |
|---|
RefreshScope(BeanContext beanContext,
Executor executorService) |
| Modifier and Type | Method and Description |
|---|---|
Class<Refreshable> |
annotationType() |
<T> Optional<BeanRegistration<T>> |
findBeanRegistration(T bean)
Get the
BeanDefinition for the given bean. |
<T> T |
get(BeanResolutionContext resolutionContext,
BeanDefinition<T> beanDefinition,
BeanIdentifier identifier,
Provider<T> provider)
Resolve an object from the given scope.
|
protected ReadWriteLock |
getLock(Object object) |
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, waitsupportspublic RefreshScope(BeanContext beanContext, @Named(value="io") Executor executorService)
beanContext - The bean context to allow DI of beans annotated with InjectexecutorService - The executor servicepublic boolean isRunning()
isRunning in interface LifeCycle<RefreshScope>public Class<Refreshable> annotationType()
annotationType in interface CustomScope<Refreshable>public <T> T get(BeanResolutionContext resolutionContext, BeanDefinition<T> beanDefinition, BeanIdentifier identifier, Provider<T> provider)
CustomScopeget in interface CustomScope<Refreshable>T - The bean generic typeresolutionContext - The bean resolution contextbeanDefinition - The bean definitionidentifier - The BeanIdentifierprovider - The provider that will build the bean definitionpublic RefreshScope stop()
LifeCyclestop in interface LifeCycle<RefreshScope>public <T> Optional<T> remove(BeanIdentifier identifier)
CustomScoperemove in interface CustomScope<Refreshable>T - The generic typeidentifier - The BeanIdentifierOptional of the instance if it existspublic void onApplicationEvent(RefreshEvent event)
ApplicationEventListeneronApplicationEvent 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 <T> Optional<BeanRegistration<T>> findBeanRegistration(T bean)
CustomScopeBeanDefinition for the given bean.findBeanRegistration in interface CustomScope<Refreshable>T - The bean generic typebean - The beanprotected ReadWriteLock getLock(Object object)
object - The bean