com.jproxy.proxy
Class ProxyHashtable

java.lang.Object
  |
  +--com.jproxy.proxy.util.ThreadSupport
        |
        +--com.jproxy.proxy.ProxyHashtable
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
Invocator

public class ProxyHashtable
extends ThreadSupport
implements java.io.Serializable

The class that keeps references of objects and tunneling objects (objects) in a hashtable and manages lifetime of the objects. ProxyHashtable runs a thread on background. The thread checks each objects time-to-live and if the time is expired then the object is recycled. If object is created by other object then all hierarhy of objects is recycled starting from latest created object.

See Also:
Invocator, com.jproxy.proxy.InvocatorHashtable, Tunnel, Serialized Form

Field Summary
 Hashtable2 hashtable
           
static java.lang.Class invocationInterceptorClass
           
 
Constructor Summary
ProxyHashtable()
          Default constructor
 
Method Summary
 HashObject create(java.lang.Object obj, long sessionId)
          Adds the object to hashtable
 HashObject get(long objectId)
          Seeks hash-object by specified objectId key value
 HashObject get(long objectId, long sessionId)
          Seeks hash-object in hashtable by specified object wrapped in hash-object.
 java.lang.Object[] keys()
           
 HashObject remove(long objectId)
          Removes object from hashtable by specified id key value.
 void removeAll()
          Removes references to all remote objects from hashtable
 void updateAllLicenses(long sessionId)
          Recursivly renewes licenses for all objects linked by parent-child relation in hashtable.
 void updateLicense(HashObject hashObject)
           
 java.lang.Object[] values()
           
 
Methods inherited from class com.jproxy.proxy.util.ThreadSupport
isRunning, isStopping, run, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

invocationInterceptorClass

public static java.lang.Class invocationInterceptorClass

hashtable

public Hashtable2 hashtable
Constructor Detail

ProxyHashtable

public ProxyHashtable()
Default constructor
Method Detail

create

public HashObject create(java.lang.Object obj,
                         long sessionId)
Adds the object to hashtable
Parameters:
obj - object that must be added to hashtable
parent - that created object or null if no such one

remove

public HashObject remove(long objectId)
Removes object from hashtable by specified id key value.
Parameters:
objectId - id of the object that must be removed from a hashtable

removeAll

public void removeAll()
Removes references to all remote objects from hashtable

updateAllLicenses

public void updateAllLicenses(long sessionId)
Recursivly renewes licenses for all objects linked by parent-child relation in hashtable. If license for object is not updated during object's time-to-live then object will be collected by running on background thread. It tries to find first parent first and then it starts renewing of licenses of objects.
Parameters:
hashObject - one of objects that belong to parent-child thread

updateLicense

public void updateLicense(HashObject hashObject)

get

public HashObject get(long objectId)
Seeks hash-object by specified objectId key value
Parameters:
objectId - key of object to be found

get

public HashObject get(long objectId,
                      long sessionId)
Seeks hash-object in hashtable by specified object wrapped in hash-object.
Parameters:
obj - object wrapped by hash-object

keys

public java.lang.Object[] keys()

values

public java.lang.Object[] values()


Copyright ⌐ JProxy LLC. All Rights Reserved.