MonitoredEntities
Class EntityTypeLocatorImpl

java.lang.Object
  |
  +--org.omg.PortableServer.Servant
        |
        +--org.omg.PortableServer.ServantLocatorPOA
              |
              +--MonitoredEntities.EntityTypeLocatorImpl
All Implemented Interfaces:
org.omg.CORBA.portable.InvokeHandler, org.omg.PortableServer.ServantLocatorOperations, org.omg.PortableServer.ServantManagerOperations

public class EntityTypeLocatorImpl
extends org.omg.PortableServer.ServantLocatorPOA

Implements the servant locator for entity type objects. This class implements the servant locator for the entity type objects. It uses the Evictor pattern described at:

Advanced CORBA Programming with C++

  • Michi Henning, Steve Vinoski
  • The Addison-Wesley Professional Computing Series

    This pattern controls the amount of entity type 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 type 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 type not on memory, the first resource event of the evictor queue is removed from there.


    Constructor Summary
    EntityTypeLocatorImpl(org.omg.CORBA.ORB orb, Persistence pobj)
              Creates the active object map and the evictor queue.
     
    Method Summary
     void free(java.lang.String metid)
              Remove from memory the servant of entity entity identified by metid.
     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 type 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
     

    Constructor Detail

    EntityTypeLocatorImpl

    public EntityTypeLocatorImpl(org.omg.CORBA.ORB orb,
                                 Persistence pobj)
    Creates the active object map and the evictor queue.
    Parameters:
    orb - reference to orb
    pobj - reference to Persistence object
    Method Detail

    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 type being requested. This method activates the entity type requested by the user based on the evictor pattern. It receives the key for the entity type that represents the meid (entity type 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 type.
    Overrides:
    preinvoke in class org.omg.PortableServer.ServantLocatorPOA
    Parameters:
    oid - the identification of the entity type being requested
    adapter -  
    operation - the operation on the entity type being requested
    cookie -  

    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 metid)
    Remove from memory the servant of entity entity identified by metid.
    Parameters:
    metid - the identity of the entity type whose servant is to be removed from memory