- Type Parameters:
T
- type of the instance
public interface Activator<T>
Activator is responsible for lifecycle management of a service instance within a scope.
-
Method Summary
Modifier and TypeMethodDescriptionactivate
(ActivationRequest activationRequest) Activate a managed service/factory.Deactivate a managed service.Description of this activator, including the current phase.Service descriptor of this activator.Get instances from this managed service.phase()
Current activation phase.
-
Method Details
-
descriptor
ServiceDescriptor<T> descriptor()Service descriptor of this activator.- Returns:
- service descriptor
-
instances
Get instances from this managed service. This method is called when we already know that this service matches the lookup, and we can safely instantiate everything.- Parameters:
lookup
- lookup to help with narrowing down the instances- Returns:
- empty optional if an instance is not available, supplier of qualified instances otherwise
-
activate
Activate a managed service/factory.- Parameters:
activationRequest
- activation request- Returns:
- the result of activation
-
deactivate
ActivationResult deactivate()Deactivate a managed service. This will trigger anyService.PreDestroy
method on the underlying service instance. The service will reach terminalActivationPhase.DESTROYED
phase, regardless of result of this call.- Returns:
- the result of deactivation
-
phase
ActivationPhase phase()Current activation phase.- Returns:
- phase of this activator
-
description
String description()Description of this activator, including the current phase.- Returns:
- description of this activator
-