Class ReadOnlyContext

java.lang.Object
org.apache.activemq.jndi.ReadOnlyContext
All Implemented Interfaces:
Serializable, Context
Direct Known Subclasses:
LazyCreateContext

public class ReadOnlyContext extends Object implements Context, Serializable
A read-only Context

This version assumes it and all its subcontext are read-only and any attempt to modify (e.g. through bind) will result in an OperationNotSupportedException. Each Context in the tree builds a cache of the entries in all sub-contexts to optimise the performance of lookup.

This implementation is intended to optimise the performance of lookup(String) to about the level of a HashMap get. It has been observed that the scheme resolution phase performed by the JVM takes considerably longer, so for optimum performance lookups should be coded like:

Context componentContext = (Context)new InitialContext().lookup("java:comp"); String envEntry = (String) componentContext.lookup("env/myEntry"); String envEntry2 = (String) componentContext.lookup("env/myEntry2"); $Date: 2005/08/27 03:52:39 $
See Also: