Implements the servant locator for entity objects.
This class implements the servant locator for the entity objects. It
uses the Evictor pattern described at:
The Addison-Wesley Professional Computing Series
This pattern controls the amount of entity objects resident
on the main memory. It maintains an active object map that holds a list
of all eneity objects currently on memory and an evictor queue
that is updated when there is a reference for an entity object. The
object referenced is placed at the end of the evictor queue. The max limit
of elements for this queue determines how many eneity objects can
reside at the same time on memory. If the limit is reached and there is a
new reference for an entity not on memory, the first resource event
of the evictor queue is removed from there.
Method Summary |
void |
free(java.lang.String meid)
Remove from memory the servant of entity identified by meid. |
void |
postinvoke(byte[] oid,
org.omg.PortableServer.POA adapter,
java.lang.String operation,
java.lang.Object cookie,
org.omg.PortableServer.Servant servant)
Does nothing. |
org.omg.PortableServer.Servant |
preinvoke(byte[] oid,
org.omg.PortableServer.POA adapter,
java.lang.String operation,
org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie)
Activate the entity being requested.
|
Methods inherited from class org.omg.PortableServer.ServantLocatorPOA |
_all_interfaces, _invoke, _this, _this |
Methods inherited from class org.omg.PortableServer.Servant |
_default_POA, _get_delegate, _get_interface, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EntityLocatorImpl
public EntityLocatorImpl(org.omg.CORBA.ORB orb,
Persistence pobj)
- Creates the active object map and the evictor queue.
- Parameters:
orb
- reference to the orbpobj
- reference to the Persistence object
preinvoke
public org.omg.PortableServer.Servant preinvoke(byte[] oid,
org.omg.PortableServer.POA adapter,
java.lang.String operation,
org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie)
throws org.omg.PortableServer.ForwardRequest
- Activate the entity being requested.
This method activates the entity requested by the user based
on the evictor pattern. It receives the key for the entity that
represents the
meid
(entity identification). It then checks if
this object exist by calling the method EExist
of the
Persistence
object. If the object exists it checks if it is
already on memory by searching the active object map. If it is not on memory
it instantiates a new servant for the entity.
- Overrides:
preinvoke
in class org.omg.PortableServer.ServantLocatorPOA
- Parameters:
oid
- the identification of the entity being requestedadapter
- operation
- the operation on the entity being requestedcookie
-
postinvoke
public void postinvoke(byte[] oid,
org.omg.PortableServer.POA adapter,
java.lang.String operation,
java.lang.Object cookie,
org.omg.PortableServer.Servant servant)
- Does nothing.
- Overrides:
postinvoke
in class org.omg.PortableServer.ServantLocatorPOA
free
public void free(java.lang.String meid)
- Remove from memory the servant of entity identified by meid.
- Parameters:
meid
- the identity of the entity servant to be removed from memory