|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
aa.tool.SystemThread
aa.core.Platform
This class represents an actor platform.
History:
| Field Summary | |
static boolean |
bDEBUG
Indicates whether debuging messages are printed on the screen. |
static boolean |
bERROR
Indicates whether error messages are printed on the screen. |
static java.util.Hashtable |
g_htCreators
Hasth table to be used for delivering a name of a new actor from the actor thread class to the actor behavior class |
private static int |
ID_DF
|
private static int |
ID_PLATFORM
|
private ActorManager |
m_amActorManager
|
private ActorName |
m_anDirectoryManager
|
private ActorName |
m_anPlatform
|
private CyberOrgManager |
m_comCyberOrgManager
|
private int |
m_iAppActorStartID
|
private static int |
m_iID_AGENT
|
private static int |
m_iID_MSG
|
private MessageManager |
m_mmMessageManager
|
private MigrationManager |
m_mmMigrationManager
|
private static Platform |
m_pPlatform
|
private Queue |
m_qMsgQueue
|
private static java.lang.String |
m_strHostAddress
|
private View |
m_viewMain
|
static java.lang.String |
MSG_CREATE_ACTOR
Actor communicaiton message that requests an actor creation. |
static java.lang.String |
MSG_DEREGISTER_AGENT
Actor communication message that indicates that a mobile actor is destroyed, and hence, information about the agnet should be removed. |
static java.lang.String |
MSG_RECEIVE_AGENT
Actor communication message that includes a mobile actor. |
static java.lang.String |
MSG_TRANSITION_END
Actor communication message that indicates that a mobile actor finishes its migration. |
static java.lang.String |
MSG_TRANSITION_START
Actor communication message that indicates that a mobile actor starts its migration. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
Platform(View p_viewMain,
java.lang.Integer p_intPort)
Creates a mulit-actor platform. |
|
| Method Summary | |
void |
afterMigrateActor(ActorName p_anActor,
java.lang.Thread p_thread)
This method is called in remote CyberOrg Migration, after migrating an actor, we need to insert it to the destination cyberorg, reallocate resource to it through the local scheduler |
protected void |
becomeActor(ActorThread p_athreadCaller,
Queue p_qMsgQueue,
boolean[] p_baFlags,
java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
Change the behavior of an actor. |
void |
changePortNumber(java.lang.Integer p_intPort)
Changes the port number for the Transprot Manager. |
ActorName |
createActor(ActorName p_anCreator,
java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
Create an Actor. |
ActorName |
createActor(java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
Creates an actor. |
java.lang.Object |
createCyberOrg(java.lang.Long p_longTicks,
java.lang.Long p_longTicksRate,
java.lang.Long p_longECash,
java.lang.String p_strFacilitatorClass,
java.lang.Object[] p_objaAgs)
Create root cyberorg, default CyberOrg class: aa.core.CyberOrg |
java.lang.Object |
createCyberOrg(java.lang.String p_strCyberOrgClass,
java.lang.Object[] p_objaAgs)
Create root cyberorg, using user defined cyberorg class |
private static ActorName |
createNewActorName()
Creates a new actor name. |
private void |
createRemoteActor(ActorMessage p_amMsg)
Creates a remote actor. |
protected static java.lang.String |
creteMessageID()
Creates a new message ID. |
void |
disactiveCyberOrg(CyberOrg p_cybToDisactive)
|
CyberOrg |
findBestDestination()
|
private java.lang.reflect.Constructor |
findConstructor(java.lang.Class p_classActor,
java.lang.Object[] p_objaArgs)
Finds a proper constructor. |
ActorName |
getActorNameOfPlatform()
Returns the actor name of this platform. |
ActorName |
getActorNameOfPlatform(java.lang.String p_strHostName)
Returns the actor name of the specified platform. |
int |
getAppActorStartID()
Returns the start number for identifications of application actors. |
protected ActorName |
getDefaultDirectoryManager()
Returns the name of the default Direcotry Manager actor. |
protected ActorName |
getDefaultDirectoryManager(java.lang.String p_strHostName)
Returns the name of the default Direcotry Manager actor of the specified platform. |
protected java.lang.String |
getHostAddress()
Returns the Inet adress of this platform. |
protected static Platform |
getPlatform()
Returns the reference of this platform. |
protected void |
init()
Processes some necessay routines before entering the while loop in the run method . |
void |
killActor(ActorName p_anToKill)
|
void |
localMigrate(CyberOrg p_cybToMigrate,
ActorName p_anDestFacilitator,
Contract p_conContract)
Local migrate it is called when a cyberorg is migrating to a local destination cyberorg |
CyberOrg |
lookupHost(java.lang.Object p_objFacilitator)
|
void |
migrateActor(ActorName p_anActor,
java.net.InetAddress p_iaDestHost)
Migrates the specified actor to a different host. |
protected void |
processMessage(ActorMessage p_amMsg)
Processes a communcation message. |
void |
reactiveCyberOrg(CyberOrg p_cybToActive)
These two methods are called when a cyberorg runs out of resource, and when it gets more resources and can be scheduled again. |
protected void |
registerActor(ActorThread p_athread,
java.lang.Integer p_intState)
Registers an actor thread to the Actor Manager of this platform. |
void |
registerActorCyb(java.lang.Object p_anActor,
CyberOrg p_cybHost)
Register actor and its host to the CyberOrgManager it is called in remote migration |
void |
registerCyberOrg(CyberOrg p_coToBeRegistered)
|
void |
remoteMigrate(CyberOrg p_cybToMigrate,
ActorName p_anDestFacilitator,
Contract p_conContract)
Remote migrate it is called when a cyberorg is migrating to a remote destination cyberorg |
protected void |
removeActor(ActorName p_anActor)
Removes the specified actor from the Actor Manager. |
void |
removeCyberOrg(CyberOrg p_coToBeRemoved)
|
protected void |
reportFailure(java.lang.String p_strMsg)
Reports that starting this platform fails. |
protected void |
reportMessage(ActorMessage p_amMsg)
Reports a message. |
boolean |
resAlloc(ActorName p_anToAlloc,
long rateAssign)
Reallocate resource for specific actor called by cyberorg isolate |
long |
returnRes(ActorName p_anActor)
Resource Return to old host by the actors called by cyberorg isolate |
void |
sendMessage(ActorMessage p_amMsg)
Sends a message through the Message manager. |
void |
uninit()
Uninitializes this program. |
protected void |
updateActor(ActorThread p_athread,
java.lang.Integer p_intState)
Updates information about an actor on the Actor Manager. |
| Methods inherited from class aa.tool.SystemThread |
deliverMessage, run |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final boolean bDEBUG
public static final boolean bERROR
public static final java.lang.String MSG_DEREGISTER_AGENT
public static final java.lang.String MSG_RECEIVE_AGENT
public static final java.lang.String MSG_TRANSITION_START
public static final java.lang.String MSG_TRANSITION_END
public static final java.lang.String MSG_CREATE_ACTOR
public static java.util.Hashtable g_htCreators
private static final int ID_PLATFORM
private static final int ID_DF
private static Platform m_pPlatform
private static int m_iID_AGENT
private static java.lang.String m_strHostAddress
private static int m_iID_MSG
private int m_iAppActorStartID
private ActorName m_anPlatform
private Queue m_qMsgQueue
private View m_viewMain
private ActorManager m_amActorManager
private MessageManager m_mmMessageManager
private MigrationManager m_mmMigrationManager
private ActorName m_anDirectoryManager
private CyberOrgManager m_comCyberOrgManager
| Constructor Detail |
public Platform(View p_viewMain,
java.lang.Integer p_intPort)
p_viewMain - the reference to Viewp_intPort - the port number of a server socket for in-coming messages| Method Detail |
protected void reportFailure(java.lang.String p_strMsg)
Platform constructor, or
the init method, or the Message Manager.
p_strMsg - a message to describe the reason of a failure.protected void init()
init in class SystemThreadpublic void uninit()
protected void processMessage(ActorMessage p_amMsg)
processMessage in class SystemThreadp_amMsg - the communication message.private static ActorName createNewActorName()
protected static java.lang.String creteMessageID()
protected static Platform getPlatform()
public int getAppActorStartID()
protected java.lang.String getHostAddress()
public ActorName getActorNameOfPlatform()
public ActorName getActorNameOfPlatform(java.lang.String p_strHostName)
p_strHostName - the host address of a platform.
null otherwise.protected ActorName getDefaultDirectoryManager()
protected ActorName getDefaultDirectoryManager(java.lang.String p_strHostName)
p_strHostName - the host address of a platform.
null otherwise.private void createRemoteActor(ActorMessage p_amMsg)
processMessage method.
p_amMsg - the communication message.
public ActorName createActor(java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
throws CreateActorException
p_strActorClass - the class of an actor to be created.p_objaArgs - arguments of the constructor of the actor.
CreateActorException - it occurs when actor creation fails.
public ActorName createActor(ActorName p_anCreator,
java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
protected void becomeActor(ActorThread p_athreadCaller,
Queue p_qMsgQueue,
boolean[] p_baFlags,
java.lang.String p_strActorClass,
java.lang.Object[] p_objaArgs)
throws BecomeActorException
p_athreadCaller - the name of an actor thread that called this method.p_baFlags - the internal state flag of the caller actor.p_strActorClass - the class name of a new actor to be replaced.p_objaArgs - arguments of the constructor of the new actor.
CreateActorException - it occurs when actor creation fails.
BecomeActorExceptionpublic void sendMessage(ActorMessage p_amMsg)
p_amMsg - an actor communication message.
protected void registerActor(ActorThread p_athread,
java.lang.Integer p_intState)
p_athread - the reference to an actor thread.p_intState - an actor state.
protected void updateActor(ActorThread p_athread,
java.lang.Integer p_intState)
p_athread - reference to an actor thread.p_intState - actor state.protected void removeActor(ActorName p_anActor)
p_anActor - Actor Name of the selected actor.
public void migrateActor(ActorName p_anActor,
java.net.InetAddress p_iaDestHost)
throws MigrateActorException
p_anActor - the name of an actor to be moved.p_iaDestHost - the Internet address of the destination host.
MigrateActorException - it occurs when an exception happens
during the actor migration.public void changePortNumber(java.lang.Integer p_intPort)
p_intPort - the new port number for transport manager.protected void reportMessage(ActorMessage p_amMsg)
p_amMsg - an actor communicaiton message.
public java.lang.Object createCyberOrg(java.lang.Long p_longTicks,
java.lang.Long p_longTicksRate,
java.lang.Long p_longECash,
java.lang.String p_strFacilitatorClass,
java.lang.Object[] p_objaAgs)
public java.lang.Object createCyberOrg(java.lang.String p_strCyberOrgClass,
java.lang.Object[] p_objaAgs)
public void registerCyberOrg(CyberOrg p_coToBeRegistered)
public void removeCyberOrg(CyberOrg p_coToBeRemoved)
private java.lang.reflect.Constructor findConstructor(java.lang.Class p_classActor,
java.lang.Object[] p_objaArgs)
throws java.lang.NoSuchMethodException
p_classActor - the class of an actor to be created.p_objaArgs - arguments of the constructor of the actor.
java.lang.NoSuchMethodException - it occurs when the construct cannot be found.public long returnRes(ActorName p_anActor)
public boolean resAlloc(ActorName p_anToAlloc,
long rateAssign)
public void localMigrate(CyberOrg p_cybToMigrate,
ActorName p_anDestFacilitator,
Contract p_conContract)
public void remoteMigrate(CyberOrg p_cybToMigrate,
ActorName p_anDestFacilitator,
Contract p_conContract)
public void registerActorCyb(java.lang.Object p_anActor,
CyberOrg p_cybHost)
public void afterMigrateActor(ActorName p_anActor,
java.lang.Thread p_thread)
public CyberOrg lookupHost(java.lang.Object p_objFacilitator)
public void killActor(ActorName p_anToKill)
public void reactiveCyberOrg(CyberOrg p_cybToActive)
public void disactiveCyberOrg(CyberOrg p_cybToDisactive)
public CyberOrg findBestDestination()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||