org.iids.aos.kernel.ac
Class AgentContainerTable

java.lang.Object
  extended by org.iids.aos.kernel.ac.AgentContainerTable

public class AgentContainerTable
extends java.lang.Object

Implements the table of agent containers and allocates agent container IDs. Thread-safe.

Author:
Patrick Verkaik

Constructor Summary
AgentContainerTable(java.io.File agentContainersDir)
           
 
Method Summary
 int createAgentContainer()
          Creates a new agent container object, allocates an agent container ID for it, and places the object in the agent container table.
 void deallocateAgentContainerID(int acid)
          Deallocates an agent container ID.
 void deleteACsOwnedBy(Role owner)
           
protected  AgentContainer getAgentContainer(int acid)
          Protected version, without locking.
 AgentContainer getAgentContainer(int acid, boolean exclusive)
          Looks up an agent container object by its ID.
 java.io.File getAgentContainersDir()
           
 void recover(RoleTable roleTable)
           
 void releaseAgentContainerLock(int acid, boolean exclusive)
          Release the lock on an agentcontainer.
 AgentContainer removeAgentContainer(int acid)
          Removes the agent container object with the given agent container ID from the table, but does *not* deallocate the agent container ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentContainerTable

public AgentContainerTable(java.io.File agentContainersDir)
Parameters:
agentContainersDir - the directory in which agent containers are stored
Method Detail

createAgentContainer

public int createAgentContainer()
                         throws InputOutputException
Creates a new agent container object, allocates an agent container ID for it, and places the object in the agent container table.

Returns:
the agent container ID for the new container object
Throws:
InputOutputException

getAgentContainer

public AgentContainer getAgentContainer(int acid,
                                        boolean exclusive)
Looks up an agent container object by its ID. Locks the agent container with the requested lock: shared or exclusive. The thread will block until the corresponding lock has been acquired. Note: access to the agentcontainer is NOT enforced by these locks. Using the locks to synchronize access is up to the caller! Locks must be released with releaseAgentContainerLock().

Returns:
the agent container object or null if acid is not associated with an agent container object

getAgentContainer

protected AgentContainer getAgentContainer(int acid)
Protected version, without locking. Only used by internal Kernel-code itself. The locked version is used by KernelImpl.java, which implements the calls visible to users and thereby synchronize access to the agent containers. Internal calls should know what they are doing!


releaseAgentContainerLock

public void releaseAgentContainerLock(int acid,
                                      boolean exclusive)
Release the lock on an agentcontainer. Note: you must hold the corresponding lock!


removeAgentContainer

public AgentContainer removeAgentContainer(int acid)
Removes the agent container object with the given agent container ID from the table, but does *not* deallocate the agent container ID.

Returns:
the removed agent container object or null if agent container ID was not valid
See Also:
deallocateAgentContainerID(int)

deallocateAgentContainerID

public void deallocateAgentContainerID(int acid)
Deallocates an agent container ID. As a pre-condition, the agent container object must already have been removed from the table.

See Also:
removeAgentContainer(int)

deleteACsOwnedBy

public void deleteACsOwnedBy(Role owner)

recover

public void recover(RoleTable roleTable)
             throws KernelException
Throws:
KernelException

getAgentContainersDir

public java.io.File getAgentContainersDir()


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.