Implements the servant locator for resource event objects.
This class implements the servant locator for the resource event objects. It
uses the Evictor pattern described at:
The Addison-Wesley Professional Computing Series
This pattern controls the amount of resource event objects resident
on the main memory. It maintains an active object map that holds a list
of all resource event objects currently on memory and an evictor queue
that is updated when there is a reference for an resource event object. The
object referenced is placed at the end of the evictor queue. The max limit
of elements for this queue determines how many resource event objects can
reside at the same time on memory. If the limit is reached and there is a
new reference for an resource event not on memory, the first resource event
of the evictor queue is removed from there.
Method Summary |
void |
free(java.lang.String eid)
Remove from memory the servant of resource event identified by eid. |
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 resource event 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 |
ResourceEventLocatorImpl
public ResourceEventLocatorImpl(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 resource event being requested.
This method activates the resource event requested by the user based
on the evictor pattern. It receives the key for the resource event that
represents the
eid
(event identification). It then checks if
this object exist by calling the method REExist
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 resource event.
- Overrides:
preinvoke
in class org.omg.PortableServer.ServantLocatorPOA
- Parameters:
oid
- the identification of the resource event being requestedadapter
- operation
- the operation on the resource event 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 eid)
- Remove from memory the servant of resource event identified by eid.
- Parameters:
eid
- the identity of the resource event servant to be removed from memory