Implements the servant locator for parameter objects.
This class implements the servant locator for the parameter objects. It
uses the Evictor pattern described at:
The Addison-Wesley Professional Computing Series
This pattern controls the amount of parameter 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 parameter 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 parameter not on memory, the first resource event
of the evictor queue is removed from there.
Method Summary |
void |
free(java.lang.String pid)
Remove from memory the servant of the parameter 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 parameter 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 |
ParameterLocatorImpl
public ParameterLocatorImpl(org.omg.CORBA.ORB orb,
Persistence pobj)
- Creates the active object map and the evictor queue.
- Parameters:
orb
- reference to orbpobj
- reference to 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 parameter being requested.
This method activates the parameter requested by the user based
on the evictor pattern. It receives the key for the parameter that
represents the
meid
(parameter 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 parameter.
- Overrides:
preinvoke
in class org.omg.PortableServer.ServantLocatorPOA
- Parameters:
oid
- the identification of the parameter being requestedadapter
- operation
- the operation on the parameter 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 pid)
- Remove from memory the servant of the parameter identified by meid.
- Parameters:
pid
- the identity of the parameter whose servant is to be removed from memory