edu.vub.at.actors.natives
Class ReceptionistsSet

java.lang.Object
  extended byedu.vub.at.actors.natives.ReceptionistsSet

public class ReceptionistsSet
extends java.lang.Object

An NATActorMirror's ReceptionistsSet keeps a mapping between identifiers and local objects which allows resolving far objects to local ones. The ReceptionistsSet also stores which actors refer to an object, which is the basis for a distributed garbage collection algorithm.

Author:
smostinc

Field Summary
private  java.util.HashMap exportedObjectsTable_
          object id (ATObjectID) -> local object (ATObject)
private  java.util.Hashtable farReferences_
          a pool of far object references: ensures that each ATObjectID is paired with a unique far object reference
private  MultiMap objectToClients_
          local object (ATObject) -> remote clients pointing to this object (Set of ATFarReference)
private  ELActor owner_
           
private  java.util.Hashtable remoteReferences_
          a pool of remote object references: ensures that each ATObjectID is paired with a unique remote object reference (and corresponding outbox)
 
Constructor Summary
ReceptionistsSet(ELActor forActor)
           
 
Method Summary
 void addClient(ATObject service, ATFarReference client)
          Invoked whenever another actor is passed a reference to an object offering a service on this actor.
private  NATLocalFarRef createLocalFarRef(ELActor actor, ATObjectID objectId, ATStripe[] stripes)
           
private  NATRemoteFarRef createRemoteFarRef(ATObjectID objectId, ATStripe[] stripes)
           
 NATLocalFarRef exportObject(ATObject object)
          Export a local object such that it now has a unique global identifier which can be distributed to other actors.
 void removeClient(ATObject service, ATFarReference client)
          Called upon the collection of a service on a remote device, or possibly when the conditions negotiated for the use of the service (e.g. its lease period) have expired.
 ATObject resolveObject(ATObjectID objectId, ATStripe[] stripes)
          Try to resolve a remote object reference into a local (near) reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exportedObjectsTable_

private final java.util.HashMap exportedObjectsTable_
object id (ATObjectID) -> local object (ATObject)


objectToClients_

private final MultiMap objectToClients_
local object (ATObject) -> remote clients pointing to this object (Set of ATFarReference)


owner_

private final ELActor owner_

remoteReferences_

private final java.util.Hashtable remoteReferences_
a pool of remote object references: ensures that each ATObjectID is paired with a unique remote object reference (and corresponding outbox)


farReferences_

private final java.util.Hashtable farReferences_
a pool of far object references: ensures that each ATObjectID is paired with a unique far object reference

Constructor Detail

ReceptionistsSet

public ReceptionistsSet(ELActor forActor)
Method Detail

createRemoteFarRef

private NATRemoteFarRef createRemoteFarRef(ATObjectID objectId,
                                           ATStripe[] stripes)

createLocalFarRef

private NATLocalFarRef createLocalFarRef(ELActor actor,
                                         ATObjectID objectId,
                                         ATStripe[] stripes)

exportObject

public NATLocalFarRef exportObject(ATObject object)
                            throws InterpreterException
Export a local object such that it now has a unique global identifier which can be distributed to other actors. Only near references may be exported.

Parameters:
object - - the local object to export to the outside world
Returns:
a local remote reference denoting the local object
Throws:
XIllegalOperation - - if object is a far reference
InterpreterException

resolveObject

public ATObject resolveObject(ATObjectID objectId,
                              ATStripe[] stripes)
Try to resolve a remote object reference into a local (near) reference.

Parameters:
objectId - the identifier of the remote object
Returns:
either the local object corresponding to that identifier, or a far reference designating the id
Throws:
InterpreterException

addClient

public void addClient(ATObject service,
                      ATFarReference client)
               throws InterpreterException
Invoked whenever another actor is passed a reference to an object offering a service on this actor. This is automatically done when serialising a local object during parameter or result passing. Upon serialisation of a far reference pointing to a service, a command object should be sent at the lowest level to invoke this method as well. This method is related to a simple reference listing strategy which should be the basis for a distributed garbage collector.

Throws:
InterpreterException

removeClient

public void removeClient(ATObject service,
                         ATFarReference client)
                  throws InterpreterException
Called upon the collection of a service on a remote device, or possibly when the conditions negotiated for the use of the service (e.g. its lease period) have expired.

Throws:
InterpreterException