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 Type Method Description
    T getComponent()
    Extract the component that does the actual work.
    void pinComponent()
    This function takes a lock on the component which guarantees that it will not be disposed until the unpin call is made.
    void unloadComponent()
    This call will wait for all transient operations to complete and then calls dispose on the components.
    void unpinComponent()
    This undoes the work that is done by pinComponent().
  • Method Details

    • 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 to unpinComponent().

    • unpinComponent

      void unpinComponent()
      This undoes the work that is done by pinComponent().
    • 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.