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 be
public class AttributeResolver extends AbstractServiceableComponent<AttributeResolver> implements
AttributeResolver, ServiceableComponent<ServiceableComponent>.
AbstractServiceableComponent will do all the work around reload and synchronization.-
Method Summary
Modifier and TypeMethodDescriptionExtract the component that does the actual work.void
This function takes a lock on the component which guarantees that it will not be disposed until the unpin call is made.void
This call will wait for all transient operations to complete and then calls dispose on the components.void
This undoes the work that is done bypinComponent()
.
-
Method Details
-
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.
-