metaglue
Class CatalogAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.NotifierAgent
                                |
                                +--metaglue.CatalogAgent
All Implemented Interfaces:
Agent, Catalog, MetagluePrimitives, Notifier, Remote, Serializable
Direct Known Subclasses:
GoodCatalogAgent

public class CatalogAgent
extends NotifierAgent
implements Catalog

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected static int GRAVEDIGGER_SLEEP
          How long gravedigger should sleep between body searches.
protected  boolean purge_icebox
           
protected  boolean should_dig
          Whether the grave_digger should quit.
protected  boolean watch_methods
          Check whether to watch and update method calls.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
CatalogAgent(AgentID agentID)
           
CatalogAgent(AgentID agentID, boolean purge_icebox)
          Main catalogAgent constructor
 
Method Summary
 void add(AgentID agentID, Remote agentAgent)
           
protected  void add(AgentID agentID, Remote agentAgent, boolean freeze)
           
 void addCatalogMonitor(CatalogMessageListener cml)
          These are methods added for the specific catalog log propagation routines due to bugs involved in trying to have the catalog propagate messages normally
protected  void addToChainingClassLoader(AgentID aid)
           
protected  void body_hunt()
          This is what gravedigger runs to look for dead agents--pulling out dead agents allows the enumerateAgents thing to work better
protected  String catalogHostName()
          Get host machine catalog is on.
 int checkStatus(AgentID agentID)
          Returns status of given agent: Agent.NOT_RUNNING, STARTING, NO_METAGLUE, DIED, ALIVE
protected  void commitAgent(AgentID agentID, Remote agentAgent, boolean isMetaglue, boolean freeze)
          Commit agent to actual repository.
protected  void dealWithBody(String lst, AgentID listingID)
          Verify and then possibly remove the given agent (with catalog listing name.
 void doneBooting()
           
 void enableMethodTracing()
           
protected  void endMethod(int cnt)
           
 Vector enumerateAgents()
          Return an enumeration of all of the AgentID's in this catalog
 Vector enumerateAgents(Filter filter)
          Get all agents which pass the test of the given filter.
protected  void freezeStub(AgentID id, Remote stub)
          Freeze a stub in the table in case the catalog dies.
 Catalog getCatalog()
           
protected  void gravedigger()
          The sleep, then search-and-destroy loop for finding dead agents.
 void log(int lvl, String msg)
          Log, and tell all catalogmonitors about the log as well.
 Agent lookup(AgentID agentID)
          Find an agent by id.
 Agent lookupBlocking(AgentID agentID)
          Do not try if agent not found.
 Agent lookupBlocking(AgentID agentID, boolean retry_if_not_found)
          Does lookup, if it finds an agentstartingexception, it waits until something changes.
protected  void purgeIcebox()
          Empty out the icebox.
protected  boolean rebindPlaceholder(AgentPlaceHolder existingBinding, AgentID agentID, Remote agentAgent, boolean freeze)
           
 void rebuildTables()
           
 void remove(AgentID agentID)
          Remove agent from the catalog.
 void removeCatalogMonitor(CatalogMessageListener cml)
          Removes the catalog monitor specified.
protected  void removeFromChainingClassLoader(AgentID aid)
           
protected  void removeFrozen(AgentID id)
           
protected  void removeFrozen(int iid, AgentID id)
           
 void replaceStartingMG(AgentID aID, AgentID mID)
           
protected  void setupIcebox()
          Not private so MetaglueAgent.main() can call it just prior to letting catalog loose on world.
protected  int startMethod(String name)
           
protected  void startMourning(AgentID agentID)
          This methods sends out messages about agents that have been found dead
 void waitForSomethingToHappen(String reas)
           
 
Methods inherited from class agentland.util.NotifierAgent
addSpy, addSpy, getNoteTypes, getNotifyTable, gossip, hack_notify, lookupSpy, notify, notify, passNotify, putNotifyTable, removeAllSpies, removeNotifyTable, removeSpy, removeSpy, removeSpy, removeSpy, removeSpy
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, lookupClass, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.util.Notifier
addSpy, addSpy, gossip, notify, passNotify, removeAllSpies, removeSpy, removeSpy
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 

Field Detail

GRAVEDIGGER_SLEEP

protected static final int GRAVEDIGGER_SLEEP
How long gravedigger should sleep between body searches. (in ms)

purge_icebox

protected boolean purge_icebox

should_dig

protected boolean should_dig
Whether the grave_digger should quit.

watch_methods

protected boolean watch_methods
Check whether to watch and update method calls.
Constructor Detail

CatalogAgent

public CatalogAgent(AgentID agentID)
             throws RemoteException

CatalogAgent

public CatalogAgent(AgentID agentID,
                    boolean purge_icebox)
             throws RemoteException
Main catalogAgent constructor
Method Detail

enableMethodTracing

public void enableMethodTracing()

doneBooting

public void doneBooting()

checkStatus

public int checkStatus(AgentID agentID)
                throws RemoteException
Returns status of given agent: Agent.NOT_RUNNING, STARTING, NO_METAGLUE, DIED, ALIVE
Specified by:
checkStatus in interface Catalog

lookup

public Agent lookup(AgentID agentID)
             throws AgentNotFoundException,
                    AgentStartingException
Find an agent by id. Removes agent if it is found to be dead, dead dead.
Specified by:
lookup in interface Catalog

replaceStartingMG

public void replaceStartingMG(AgentID aID,
                              AgentID mID)
Specified by:
replaceStartingMG in interface Catalog

waitForSomethingToHappen

public void waitForSomethingToHappen(String reas)

lookupBlocking

public Agent lookupBlocking(AgentID agentID)
                     throws AgentNotFoundException
Do not try if agent not found.
Specified by:
lookupBlocking in interface Catalog

lookupBlocking

public Agent lookupBlocking(AgentID agentID,
                            boolean retry_if_not_found)
                     throws AgentNotFoundException
Description copied from interface: Catalog
Does lookup, if it finds an agentstartingexception, it waits until something changes. If it does not find an agent at all, it
Specified by:
lookupBlocking in interface Catalog

getCatalog

public Catalog getCatalog()
                   throws RemoteException
Overrides:
getCatalog in class AgentAgent

add

public void add(AgentID agentID,
                Remote agentAgent)
         throws RemoteException,
                AlreadyBoundException
Specified by:
add in interface Catalog

remove

public void remove(AgentID agentID)
            throws RemoteException,
                   AccessException
Remove agent from the catalog.
Specified by:
remove in interface Catalog

rebuildTables

public void rebuildTables()

enumerateAgents

public Vector enumerateAgents()
                       throws RemoteException
Return an enumeration of all of the AgentID's in this catalog
Specified by:
enumerateAgents in interface Catalog

enumerateAgents

public Vector enumerateAgents(Filter filter)
Get all agents which pass the test of the given filter.
Specified by:
enumerateAgents in interface Catalog
Following copied from interface: metaglue.Catalog
Returns:
Vector of AgentIDs

addCatalogMonitor

public void addCatalogMonitor(CatalogMessageListener cml)
                       throws RemoteException
These are methods added for the specific catalog log propagation routines due to bugs involved in trying to have the catalog propagate messages normally
Specified by:
addCatalogMonitor in interface Catalog

removeCatalogMonitor

public void removeCatalogMonitor(CatalogMessageListener cml)
                          throws RemoteException
Removes the catalog monitor specified.
Specified by:
removeCatalogMonitor in interface Catalog
Parameters:
cml - a CatalogMessageListener value

log

public void log(int lvl,
                String msg)
Log, and tell all catalogmonitors about the log as well.
Overrides:
log in class AgentAgent
Following copied from class: metaglue.AgentAgent
Parameters:
level - The log level.
info - The string to send to the log.
See Also:
LogStream

startMethod

protected int startMethod(String name)

endMethod

protected void endMethod(int cnt)

catalogHostName

protected String catalogHostName()
                          throws RemoteException
Get host machine catalog is on.

commitAgent

protected void commitAgent(AgentID agentID,
                           Remote agentAgent,
                           boolean isMetaglue,
                           boolean freeze)
Commit agent to actual repository. Do all the gossiping, etc.

rebindPlaceholder

protected boolean rebindPlaceholder(AgentPlaceHolder existingBinding,
                                    AgentID agentID,
                                    Remote agentAgent,
                                    boolean freeze)
                             throws RemoteException
Returns:
success

add

protected void add(AgentID agentID,
                   Remote agentAgent,
                   boolean freeze)
            throws RemoteException,
                   AlreadyBoundException
Parameters:
freeze - whether to freeze stub in icebox--this should be true. it is false when the defrosting happens and the tables are being rebuilt.

startMourning

protected void startMourning(AgentID agentID)
                      throws RemoteException
This methods sends out messages about agents that have been found dead
Parameters:
agentID - agentID of a dead agent

purgeIcebox

protected void purgeIcebox()
Empty out the icebox.

setupIcebox

protected void setupIcebox()
Not private so MetaglueAgent.main() can call it just prior to letting catalog loose on world.

removeFrozen

protected void removeFrozen(AgentID id)

removeFrozen

protected void removeFrozen(int iid,
                            AgentID id)
Parameters:
iid - icebox id of agent in question.
id - agent id

freezeStub

protected void freezeStub(AgentID id,
                          Remote stub)
Freeze a stub in the table in case the catalog dies. Precondition: stub is NOT an agent placeholder.

body_hunt

protected void body_hunt()
This is what gravedigger runs to look for dead agents--pulling out dead agents allows the enumerateAgents thing to work better

dealWithBody

protected void dealWithBody(String lst,
                            AgentID listingID)
Verify and then possibly remove the given agent (with catalog listing name. Used by gravedigger.

gravedigger

protected void gravedigger()
The sleep, then search-and-destroy loop for finding dead agents.

addToChainingClassLoader

protected void addToChainingClassLoader(AgentID aid)

removeFromChainingClassLoader

protected void removeFromChainingClassLoader(AgentID aid)