|
|||||||||||
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.MigrationManager
This class specifies a Migration Manger to handle mobile actors.
History:
Field Summary | |
private ActorManager |
m_amActorManager
The reference to the Actor Manager of this actor platform. |
private ActorName |
m_anPlatform
The actor name of this actor platform. |
private DelayedMessageManager |
m_dmmDelayedMessageManager
The reference to the Delayed Message Manager of this actor platform. |
private MessageManager |
m_mmMessageManager
The reference to the Message Manager of this actor platform. |
private Platform |
m_pPlatform
The reference to this actor platform. |
private java.lang.String |
m_strHostAddressOfPlatform
The host address of this platform. |
private java.util.TreeMap |
m_tmMobileActorClasses
The class data repository for mobile actors. |
Fields inherited from class aa.tool.SystemThread |
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
MigrationManager(Platform p_pPlatform,
ActorManager p_amActorManager)
Creates a Migration Manager. |
Method Summary | |
private java.lang.Object |
deserialize(java.lang.String p_strClassName,
byte[] pp_baClass,
byte[] p_baStream)
Deserialize a byte stream into an object. |
private byte[] |
fetchClassFile(java.lang.String p_strClassName)
Fetches the byte array of the specified class. |
protected void |
informMigrationEnd(ActorName p_anActor,
java.lang.String p_strHostAddress)
Informs that migration of a mobile actor ends. |
protected void |
informMigrationStart(ActorName p_anActor,
java.lang.String p_strHostAddress)
Informs that migration of a mobile actor starts. |
protected void |
init()
Processes some necessay routines before entering the main loop in the 'run' method. |
protected void |
migrateActor(ActorName p_anActor,
java.net.InetAddress p_iaDestHost)
Moves the specified actor to another host. |
protected void |
processMessage(ActorMessage p_amMsg)
Processes a communication messages. |
private void |
reactivateActor(ActorThread p_athread)
Reactivates a mobile actor. |
protected void |
receiveActor(java.lang.String p_strClassName,
byte[] p_baClass,
byte[] p_baActor,
ActorName p_anPlatform)
Receives an actor. |
private void |
sendErrorMessage(ActorName p_anReceiver,
java.lang.String p_strMsg)
Sends an error message. |
private byte[] |
serialize(java.io.Serializable p_serObj)
Serializes an object into a byte stream. |
protected void |
setDelayedMessageManager(DelayedMessageManager p_dmm)
Sets the reference to the Delayed Message Manager. |
protected void |
setMessageManager(MessageManager p_mm)
Sets the reference to the Message Manager. |
protected void |
uninit()
Uninitializes this component. |
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 |
private java.lang.String m_strHostAddressOfPlatform
private ActorName m_anPlatform
private java.util.TreeMap m_tmMobileActorClasses
private Platform m_pPlatform
private ActorManager m_amActorManager
private MessageManager m_mmMessageManager
private DelayedMessageManager m_dmmDelayedMessageManager
Constructor Detail |
public MigrationManager(Platform p_pPlatform, ActorManager p_amActorManager)
p_pPlatform
- the reference to this platform.p_amActorManager
- the reference to an Actor Manager.Method Detail |
protected void init()
init
in class SystemThread
protected void uninit()
protected void setMessageManager(MessageManager p_mm)
p_mm
- the reference to the Message Manager.protected void setDelayedMessageManager(DelayedMessageManager p_dmm)
p_dmm
- the reference to the Delayed Message Manager.protected void processMessage(ActorMessage p_amMsg)
processMessage
in class SystemThread
p_amMsg
- an actor communication message.private void sendErrorMessage(ActorName p_anReceiver, java.lang.String p_strMsg)
p_anReceiver
- the name of the receiver actor.p_strMsg
- an error message.private byte[] fetchClassFile(java.lang.String p_strClassName) throws java.lang.ClassNotFoundException
p_strClassName
- the name of the specified class.
java.lang.ClassNotFoundException
- throw when the system cannot find the class.private byte[] serialize(java.io.Serializable p_serObj) throws java.io.IOException
p_serObj
- the input serializable object.
java.io.IOException
private java.lang.Object deserialize(java.lang.String p_strClassName, byte[] pp_baClass, byte[] p_baStream) throws java.io.IOException, java.lang.ClassNotFoundException
p_strClassName
- the name of the specified class.pp_baClass
- the input byte stream for the class information.p_baStream
- the input byte stream for an instance of the class.
java.io.IOException
java.lang.ClassNotFoundException
private void reactivateActor(ActorThread p_athread)
p_athread
- the reference to an Actor class.protected 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.protected void receiveActor(java.lang.String p_strClassName, byte[] p_baClass, byte[] p_baActor, ActorName p_anPlatform)
Platform
class.
p_strClassName
- the class name of a mobile actor.p_baClass
- an input byte stream of the class.p_baActor
- an input byte stream of the actor.p_anPlatform
- the actor name of this platform.protected void informMigrationStart(ActorName p_anActor, java.lang.String p_strHostAddress)
Platform
class.
p_anActor
- the name of a mobile actor.protected void informMigrationEnd(ActorName p_anActor, java.lang.String p_strHostAddress)
Platform
class.
p_anActor
- the name of a mobile actor.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |