Package net.shibboleth.shared.service
Class SupplierBackedReloadableService<T>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.service.SupplierBackedReloadableService<T>
- Type Parameters:
T- component type
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ReloadableService<T>
public class SupplierBackedReloadableService<T>
extends AbstractInitializableComponent
implements ReloadableService<T>
A "null" implementation of
ReloadableService that obtains an instance of an
object via a strategy and exposes it as though it were a component wrapped
by a service by nulling the relevant methods and interfaces.- Since:
- 9.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classDummy wrapper. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe supplier of the component to expose. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the time when the service last attempted to reload.Gets the time when the service was last successfully reloaded.Gets the reason the last reload failed.Get the serviceable component that this service supports.voidreload()Reloads the configuration of the service.Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
componentSource
The supplier of the component to expose.
-
-
Constructor Details
-
SupplierBackedReloadableService
Constructor.- Parameters:
supplier- source of component called when the component is requested
-
-
Method Details
-
getLastSuccessfulReloadInstant
Gets the time when the service was last successfully reloaded. Returns null if the service has never reloaded.- Specified by:
getLastSuccessfulReloadInstantin interfaceReloadableService<T>- Returns:
- time when the service was last successfully reloaded
-
getLastReloadAttemptInstant
Gets the time when the service last attempted to reload. If the reload was successful this time should match the time given byReloadableService.getLastSuccessfulReloadInstant().- Specified by:
getLastReloadAttemptInstantin interfaceReloadableService<T>- Returns:
- time when the service last attempted to reload
-
getReloadFailureCause
Gets the reason the last reload failed.- Specified by:
getReloadFailureCausein interfaceReloadableService<T>- Returns:
- reason the last reload failed or null if the last reload was successful
-
reload
public void reload()Reloads the configuration of the service. Whether internal state is maintained between reloads is implementation dependent.- Specified by:
reloadin interfaceReloadableService<T>
-
getServiceableComponent
Get the serviceable component that this service supports. If the component hasn't been successfully loaded yet or if this service does not support a ServiceableComponent, aServiceExceptionis raised.On a non-null value, the returned component will be pinned and MUST be closed. This can be done by exploiting the fact that a ServiceableComponent implements
AutoCloseable- Specified by:
getServiceableComponentin interfaceReloadableService<T>- Returns:
- the component, if appropriate.
- Throws:
ServiceException- if the component is not available
-