fr.dyade.aaa.agent
Class HAEngine

java.lang.Object
  extended by fr.dyade.aaa.agent.Engine
      extended by fr.dyade.aaa.agent.HAEngine
All Implemented Interfaces:
EngineMBean, MessageConsumer, java.lang.Runnable

final class HAEngine
extends Engine

Implementation of Engine that used JGroups in order to improve reliability.


Nested Class Summary
 
Nested classes/interfaces inherited from class fr.dyade.aaa.agent.Engine
Engine.EngineAverageLoadTask
 
Field Summary
private static long DEFAULT_HA_TIMEOUT
           
private static java.lang.String HA_TIMEOUT_PROPERTY
           
private  JGroups jgroups
          JGroups component
(package private)  boolean needToSync
           
private  java.util.Vector qinFromExt
          Queue of messages provide from external agent.
(package private)  java.util.Vector requestor
           
 
Fields inherited from class fr.dyade.aaa.agent.Engine
agent, agentProfiling, agents, averageLoadTask, canStop, fixedAgentIdList, isRunning, logmon, mq, msg, NbMaxAgents, needToBeCommited, now, qin, recoveryPolicy, RP_EXC_NOT, RP_EXIT, rpStrings, thread, timeout
 
Constructor Summary
HAEngine()
           
 
Method Summary
(package private)  void abort(java.lang.Exception exc)
          Abort the agent reaction in case of error during execution.
(package private)  void commit()
          Commit the agent reaction in case of rigth termination: suppress the processed notification from message queue, then deletes it ; push all new notifications in qin and qout, and saves them ; saves the agent state ; then commit the transaction to validate all changes.
(package private)  void getState()
          Get the current state of Engine: agents, messages, etc.
(package private)  java.lang.Object load(byte[] buf)
           
protected  void onTimeOut()
           
 void post(Message msg)
          Adds a message in "ready to deliver" list.
private  void postFromExt()
          If the internal queue is empty, moves the first message from external queue.
(package private)  void receiveFromJGroups(Message msg)
           
 void restore()
          Restores logical clock information from persistent storage.
 void save()
          Saves logical clock information to persistent storage.
 void setJGroups(JGroups jgroups)
           
(package private)  void setState(HAStateReply reply)
           
 void validate()
          Validates all messages pushed in queue during transaction session.
 
Methods inherited from class fr.dyade.aaa.agent.Engine
addFixedAgentId, clean, createAgent, createAgent, delete, deleteAgent, dispatch, dumpAgent, dumpAgent, garbage, getAverageLoad1, getAverageLoad15, getAverageLoad5, getCommitTime, getDomainName, getLoadedAgentIdlist, getName, getNbAgents, getNbFixedAgents, getNbMaxAgents, getNbMessages, getNbReactions, getNbWaitingMessages, getQueue, getReactTime, getStamp, init, insert, isAgentProfiling, isRunning, load, newInstance, push, reload, removeFixedAgentId, run, setAgentProfiling, setNbMaxAgents, setStamp, stamp, start, stop, terminate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

qinFromExt

private java.util.Vector qinFromExt
Queue of messages provide from external agent.


jgroups

private JGroups jgroups
JGroups component


DEFAULT_HA_TIMEOUT

private static long DEFAULT_HA_TIMEOUT

HA_TIMEOUT_PROPERTY

private static java.lang.String HA_TIMEOUT_PROPERTY

needToSync

volatile boolean needToSync

requestor

volatile java.util.Vector requestor
Constructor Detail

HAEngine

HAEngine()
   throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

setJGroups

public void setJGroups(JGroups jgroups)

save

public void save()
          throws java.io.IOException
Saves logical clock information to persistent storage.

Specified by:
save in interface MessageConsumer
Overrides:
save in class Engine
Throws:
java.io.IOException

restore

public void restore()
             throws java.lang.Exception
Restores logical clock information from persistent storage.

Specified by:
restore in interface MessageConsumer
Overrides:
restore in class Engine
Throws:
java.lang.Exception

post

public void post(Message msg)
          throws java.lang.Exception
Adds a message in "ready to deliver" list. This method allocates a new time stamp to the message ; be Careful, changing the stamp imply the filename change too.

Specified by:
post in interface MessageConsumer
Overrides:
post in class Engine
Throws:
java.lang.Exception

postFromExt

private void postFromExt()
If the internal queue is empty, moves the first message from external queue. Il must always be bracketed by transaction begin and release methods.


validate

public void validate()
Validates all messages pushed in queue during transaction session.

Specified by:
validate in interface MessageConsumer
Overrides:
validate in class Engine

commit

void commit()
      throws java.lang.Exception
Commit the agent reaction in case of rigth termination:

Overrides:
commit in class Engine
Throws:
java.lang.Exception

abort

void abort(java.lang.Exception exc)
     throws java.lang.Exception
Abort the agent reaction in case of error during execution. In case of unrecoverable error during the reaction we have to rollback:

Overrides:
abort in class Engine
Throws:
java.lang.Exception

receiveFromJGroups

void receiveFromJGroups(Message msg)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getState

void getState()
        throws java.lang.Exception
Get the current state of Engine: agents, messages, etc. This operation is done in transactoion so Engine can't get more messages and Network can't post new !!

Throws:
java.lang.Exception

setState

void setState(HAStateReply reply)
        throws java.lang.Exception
Throws:
java.lang.Exception

load

java.lang.Object load(byte[] buf)
                throws java.lang.Exception
Throws:
java.lang.Exception

onTimeOut

protected void onTimeOut()
                  throws java.lang.Exception
Overrides:
onTimeOut in class Engine
Throws:
java.lang.Exception


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.