public abstract class Negotiator<STATE extends Enum<?>,EVENT extends Enum<?>> extends FiniteStateMachine<STATE,EVENT,INegotiationContext> implements INegotiator, INegotiationContext.Receiver
FiniteStateMachine.ChangeStateTransition, FiniteStateMachine.FailTransition, FiniteStateMachine.IgnoreTransition, FiniteStateMachine.StateChangedEvent
ILifecycle.DeferrableActivation
FAIL, IGNORE
Constructor and Description |
---|
Negotiator(Class<STATE> stateEnum,
Class<EVENT> eventEnum,
STATE initialState,
STATE successState,
STATE failureState,
EVENT startEvent,
EVENT bufferEvent,
boolean initiator) |
Modifier and Type | Method and Description |
---|---|
EVENT |
getBufferEvent() |
STATE |
getFailureState() |
STATE |
getInitialState() |
EVENT |
getStartEvent() |
STATE |
getSuccessState() |
protected void |
handleFailure(INegotiationContext context) |
protected void |
handleSuccess(INegotiationContext context) |
boolean |
isInitiator() |
void |
negotiate(INegotiationContext context) |
protected void |
postProcess(INegotiationContext context) |
void |
receiveBuffer(INegotiationContext context,
ByteBuffer buffer) |
changeState, createFailTransition, createIgnoreTransition, formatFailMessage, formatIgnoreMessage, formatProcessMessage, getEvents, getState, getStates, getTransition, init, init, initAll, initAll, initEvents, initEvents, initStates, initStates, process, setState
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, getListeners, hasListeners, removeListener
public STATE getInitialState()
public STATE getSuccessState()
public STATE getFailureState()
public EVENT getBufferEvent()
public EVENT getStartEvent()
public boolean isInitiator()
isInitiator
in interface INegotiator
public void negotiate(INegotiationContext context)
negotiate
in interface INegotiator
public void receiveBuffer(INegotiationContext context, ByteBuffer buffer)
receiveBuffer
in interface INegotiationContext.Receiver
protected void postProcess(INegotiationContext context)
protected void handleSuccess(INegotiationContext context)
protected void handleFailure(INegotiationContext context)
Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.