org.jdiameter.client.impl.fsm
Class PeerFSMImpl

java.lang.Object
  extended by org.jdiameter.client.impl.fsm.PeerFSMImpl
All Implemented Interfaces:
StateMachine, IStateMachine
Direct Known Subclasses:
PeerFSMImpl

public class PeerFSMImpl
extends java.lang.Object
implements IStateMachine

Author:
erick.svenson@yahoo.com, Alexandre Mendonca , Bartosz Baranowski

Nested Class Summary
protected  class PeerFSMImpl.MyState
           
 
Field Summary
protected  long CEA_TIMEOUT
           
protected  IConcurrentFactory concurrentFactory
           
protected  IContext context
           
protected  Dictionary dictionary
           
protected  long DPA_TIMEOUT
           
protected  long DWA_TIMEOUT
           
protected  java.util.concurrent.LinkedBlockingQueue<StateEvent> eventQueue
           
protected  long IAC_TIMEOUT
           
protected  java.util.concurrent.ConcurrentLinkedQueue<StateChangeListener> listeners
           
protected  boolean mustRun
           
protected  java.util.concurrent.atomic.AtomicInteger numberOfThreadsRunning
           
protected  int predefSize
           
protected  IStatistic queueStat
           
protected  java.util.Random random
           
protected  long REC_TIMEOUT
           
protected  FsmState state
           
protected  State[] states
           
protected  IStatisticManager statisticFactory
           
protected  IStatisticRecord timeCount
           
protected  StateEvent timeOutEvent
           
protected  long timer
           
protected  IStatisticRecord timeSumm
           
protected  boolean watchdogSent
           
 
Constructor Summary
PeerFSMImpl(IContext aContext, IConcurrentFactory concurrentFactory, Configuration config, IStatisticManager statisticFactory)
           
 
Method Summary
 void addStateChangeNotification(StateChangeListener stateChangeListener)
           
 double getQueueInfo()
          This method returns occupancy of event queue
<E> E
getState(java.lang.Class<E> a)
           
protected  State[] getStates()
           
 IStatistic getStatistic()
           
 boolean handleEvent(StateEvent event)
           
protected  void loadTimeOuts(Configuration config)
           
 void removeStateChangeNotification(StateChangeListener stateChangeListener)
           
 void remStateChangeNotification(StateChangeListener stateChangeListener)
           
protected  void setInActiveTimer()
           
protected  void switchToNextState(FsmState newState)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dictionary

protected final Dictionary dictionary

listeners

protected java.util.concurrent.ConcurrentLinkedQueue<StateChangeListener> listeners

eventQueue

protected java.util.concurrent.LinkedBlockingQueue<StateEvent> eventQueue

state

protected FsmState state

watchdogSent

protected boolean watchdogSent

timer

protected long timer

CEA_TIMEOUT

protected long CEA_TIMEOUT

IAC_TIMEOUT

protected long IAC_TIMEOUT

REC_TIMEOUT

protected long REC_TIMEOUT

DWA_TIMEOUT

protected long DWA_TIMEOUT

DPA_TIMEOUT

protected long DPA_TIMEOUT

timeOutEvent

protected final StateEvent timeOutEvent

random

protected java.util.Random random

concurrentFactory

protected IConcurrentFactory concurrentFactory

context

protected IContext context

states

protected State[] states

predefSize

protected int predefSize

statisticFactory

protected IStatisticManager statisticFactory

queueStat

protected IStatistic queueStat

timeSumm

protected IStatisticRecord timeSumm

timeCount

protected IStatisticRecord timeCount

mustRun

protected boolean mustRun

numberOfThreadsRunning

protected java.util.concurrent.atomic.AtomicInteger numberOfThreadsRunning
Constructor Detail

PeerFSMImpl

public PeerFSMImpl(IContext aContext,
                   IConcurrentFactory concurrentFactory,
                   Configuration config,
                   IStatisticManager statisticFactory)
Method Detail

getStatistic

public IStatistic getStatistic()
Specified by:
getStatistic in interface IStateMachine

removeStateChangeNotification

public void removeStateChangeNotification(StateChangeListener stateChangeListener)
Specified by:
removeStateChangeNotification in interface StateMachine

getQueueInfo

public double getQueueInfo()
Description copied from interface: IStateMachine
This method returns occupancy of event queue

Specified by:
getQueueInfo in interface IStateMachine
Returns:
occupancy of event queue

loadTimeOuts

protected void loadTimeOuts(Configuration config)

addStateChangeNotification

public void addStateChangeNotification(StateChangeListener stateChangeListener)
Specified by:
addStateChangeNotification in interface StateMachine

remStateChangeNotification

public void remStateChangeNotification(StateChangeListener stateChangeListener)
Specified by:
remStateChangeNotification in interface IStateMachine

switchToNextState

protected void switchToNextState(FsmState newState)

handleEvent

public boolean handleEvent(StateEvent event)
                    throws java.lang.InternalError,
                           OverloadException
Specified by:
handleEvent in interface StateMachine
Throws:
java.lang.InternalError
OverloadException

setInActiveTimer

protected void setInActiveTimer()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getState

public <E> E getState(java.lang.Class<E> a)
Specified by:
getState in interface StateMachine

getStates

protected State[] getStates()


Copyright © 2014. All Rights Reserved.