Interface ServiceableComponent<T>
-
- Type Parameters:
T- The underlying type of the component.
public interface ServiceableComponent<T>Any component that wants to be reloaded via the Service interface and Spring implements this interface. The idea is that the attribute resolver will bepublic class AttributeResolver extends AbstractServiceableComponent<AttributeResolver> implements AttributeResolver, ServiceableComponent<ServiceableComponent>.AbstractServiceableComponent will do all the work around reload and synchronization.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TgetComponent()Extract the component that does the actual work.voidpinComponent()This function takes a lock on the component which guarantees that it will not be disposed until the unpin call is made.voidunloadComponent()This call will wait for all transient operations to complete and then calls dispose on the components.voidunpinComponent()This undoes the work that is done bypinComponent().
-
-
-
Method Detail
-
getComponent
@Nonnull T getComponent()
Extract the component that does the actual work. Callers MUST have the ServiceableComponent pinned at this stage.- Returns:
- the component.
-
pinComponent
void pinComponent()
This function takes a lock on the component which guarantees that it will not be disposed until the unpin call is made.This method is typically only used during initialization of the component.
Every call to
pinComponent()must be matched by a call tounpinComponent().
-
unpinComponent
void unpinComponent()
This undoes the work that is done bypinComponent().
-
unloadComponent
void unloadComponent()
This call will wait for all transient operations to complete and then calls dispose on the components.Implementations should avoid calling this with locks held.
-
-