public interface ScalingActionPlugin
Components that want to listen to scaling actions should implement this interface and register that
implementation in the service registry. Only one plugin should be registered, but in the event multiple
services are present the actionRequired
method will only be called on the service with the highest
cardinality. Services are ranked through ServiceReference.compareTo(java.lang.Object)
using service.ranking
(highest to lowest) and service.id
(lowest to highest).
Modifier and Type | Method and Description |
---|---|
ScalingActionContext.ActionDecision |
actionRequired(ScalingActionContext action)
This method is called by the
ScalingController when a scaling action is required. |
ScalingActionContext.ActionDecision actionRequired(ScalingActionContext action)
This method is called by the ScalingController
when a scaling action is required. The type of
the required action is set in the actionType
property in the ScalingActionContext
argument. The possible required action types are:
ScalingActionContext.ActionType.START_SERVER
: a
server should be started.ScalingActionContext.ActionType.CREATE_SERVER
: a
new server should be provisioned.ScalingActionContext.ActionType.STOP_SERVER
: a
started server should be stopped.
The scaling listener should determine the best course of action and indicate the decision to the
scaling controller through the return value of this method using one of the
ScalingActionContext.ActionDecision
values:
ScalingActionContext.ActionDecision.CANDIDATE_SELECTED
: The scaling action is executed against the candidate(s) identified in the
ScalingActionContext.getTargets
list.ScalingActionContext.ActionDecision.SELF_ACTION
:
The scaling action is executed by the scaling listener. When the action reason is
ScalingActionContext.ActionReason.SCALE_OUT
or
ScalingActionContext.ActionReason.SCALE_IN
the
ScalingController
will not request another action until the time set through the
ScalingActionContext.setDecisionTimeout(long, java.util.concurrent.TimeUnit)
method has elapsed or the scaling membership changes.ScalingActionContext.ActionDecision.DEFAULT_ACTION
:
The ScalingController
executes the default action against one of the candidates. This decision
should be taken when the scaling listener takes no action.Calls to this method are serialized.
action
- This argument has information about the required action. The same object can be used to pass
information back to the scaling controller. See ScalingActionContext
for details.ScalingActionContext.ActionDecision
values.ScalingActionContext