org.apache.axis2.context
Class AbstractContext

java.lang.Object
  extended byorg.apache.axis2.context.AbstractContext
Direct Known Subclasses:
ConfigurationContext, MessageContext, OperationContext, ServiceContext, ServiceGroupContext, SessionContext

public abstract class AbstractContext
extends Object

This is the top most level of the Context hierachy and is a bag of properties.


Field Summary
protected  long lastTouchedTime
           
protected  AbstractContext parent
           
protected  Map properties
           
 
Constructor Summary
protected AbstractContext(AbstractContext parent)
           
 
Method Summary
 long getLastTouchedTime()
           
 AbstractContext getParent()
           
 Map getProperties()
           
 Object getProperty(String key)
          Retrieves an object given a key.
 void setParent(AbstractContext context)
           
 void setProperties(Map properties)
          This will set the properties to the context.
 void setProperty(String key, Object value)
          Store a property for message context
protected  void touch()
          ServiceContext and ServiceGroupContext are not getting automatically garbage collected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastTouchedTime

protected long lastTouchedTime

parent

protected transient AbstractContext parent

properties

protected transient Map properties
Constructor Detail

AbstractContext

protected AbstractContext(AbstractContext parent)
Method Detail

getParent

public AbstractContext getParent()
Returns:
Returns AbstractContext.

getProperties

public Map getProperties()

getProperty

public Object getProperty(String key)
Retrieves an object given a key.

Parameters:
key - - if not found, will return null
Returns:
Returns the property.

setParent

public void setParent(AbstractContext context)
Parameters:
context -

setProperties

public void setProperties(Map properties)
This will set the properties to the context. But in setting that one may need to "copy" all the properties from the source properties to the target properties. To enable this we introduced a property (org.apache.axis2.client.Options#COPY_PROPERTIES) so that if set to true, this code will copy the whole thing, without just referencing to the source.

Parameters:
properties -
See Also:
Options.COPY_PROPERTIES

setProperty

public void setProperty(String key,
                        Object value)
Store a property for message context

Parameters:
key -
value -

touch

protected void touch()
ServiceContext and ServiceGroupContext are not getting automatically garbage collected. And there is no specific way for some one to go and make it garbage collectable. So the current solution is to make them time out. So the logic is that, there is a timer task in each and every service group which will check for the last touched time. And if it has not been touched for some time, the timer task will remove it from the memory. The touching logic happens like this. Whenever there is a call to addMessageContext in the operationContext it will go and update operationCOntext -> serviceContext -> serviceGroupContext.


getLastTouchedTime

public long getLastTouchedTime()