com.jproxy.proxy
Class ProxyHashtable

java.lang.Object
  extended bycom.jproxy.proxy.util.ThreadSupport
      extended bycom.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
 java.util.Hashtable hashtable
           
static java.lang.Class invocationInterceptorClass
           
 java.util.Hashtable sessionHash
           
 
Fields inherited from class com.jproxy.proxy.util.ThreadSupport
threads
 
Constructor Summary
ProxyHashtable()
          Default constructor
 
Method Summary
 void addSessionObject(long sessionId, HashObject obj)
           
 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
 java.util.Hashtable getSessionObjects(long sessionId)
           
 java.lang.Object[] keys()
          Seeks hash-object in hashtable by specified object wrapped in hash-object.
 HashObject remove(long objectId)
          Removes object from hashtable by specified id key value.
 void removeAll()
          Removes references to all remote objects from hashtable
 void removeSessionObject(long sessionId, long objectId)
           
 void updateLicense(HashObject hashObject)
           
 int updateSession(long sessionId)
          Recursivly renewes licenses for all objects linked by parent-child relation in hashtable.
 java.lang.Object[] values()
           
 
Methods inherited from class com.jproxy.proxy.util.ThreadSupport
getThread, isRunning, isStopping, run, start, stop, stop, stopAll
 
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 java.util.Hashtable hashtable

sessionHash

public java.util.Hashtable sessionHash
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

getSessionObjects

public java.util.Hashtable getSessionObjects(long sessionId)

addSessionObject

public void addSessionObject(long sessionId,
                             HashObject obj)

removeSessionObject

public void removeSessionObject(long sessionId,
                                long objectId)

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


updateSession

public int updateSession(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.


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

keys

public java.lang.Object[] keys()
Seeks hash-object in hashtable by specified object wrapped in hash-object.


values

public java.lang.Object[] values()


Copyright © JProxy LLC. All Rights Reserved.