Home » db-derby- » org.apache.derby.iapi.services.context » [javadoc | source]
public class: ContextManager [javadoc | source]
The ContextManager collects contexts as they are created. It maintains stacks of contexts by named ids, so that the top context of a given type can be returned. It also maintains a global stack so that contexts can be traversed in the order they were created.

The first implementation of the context manager assumes there is only one thread to worry about and that the user(s) of the class only create one instance of ContextManager.
Field Summary
final  ContextService owningCsf     
 Thread activeThread    The thread that owns this ContextManager, set by ContextService.setCurrentContextManager and reset by resetCurrentContextManager. Only a single thread can be active in a ContextManager at any time, and the thread only "owns" the ContextManager while it is executing code within Derby. In the JDBC case setCurrentContextManager is called at the start of a JBDC method and resetCurrentContextManager on completion. Nesting within the same thread is supported, such as server-side JDBC calls in a Java routine or procedure. In that case the activeCount will represent the level of nesting, in some situations.
    Also see:
 int activeCount    Count of the number of setCurrentContextManager calls by a single thread, for nesting situations with a single active Contextmanager. If nesting is occuring with multiple different ContextManagers then this value is set to -1 and nesting is represented by entries in a stack in the ThreadLocal variable, threadContextList.
    Also see:
 ContextManager(ContextService csf,
    HeaderPrintWriter stream) 
    Constructs a new instance. No CtxStacks are inserted into the hashMap as they will be allocated on demand.
    csf - the ContextService owning this ContextManager
    stream - error stream for reporting errors
Method from org.apache.derby.iapi.services.context.ContextManager Summary:
cleanupOnError,   getContext,   getContextStack,   getMessageLocale,   isEmpty,   popContext,   popContext,   pushContext,   setInterrupted,   setLocaleFinder,   setMessageLocale
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.derby.iapi.services.context.ContextManager Detail:
 public boolean cleanupOnError(Throwable error) 
 public Context getContext(String contextId) 
    Obtain the last pushed Context object of the type indicated by the contextId argument.
 public final List getContextStack(String contextId) 
    Return an unmodifiable list reference to the ArrayList backing CtxStack object for this type of Contexts. This method allows fast traversal of all Contexts on that stack. The first element in the List corresponds to the bottom of the stack. The assumption is that the Stack will not be modified while it is being traversed.
 public Locale getMessageLocale() 
 final boolean isEmpty() 
    Is the ContextManager empty containing no Contexts.
 public  void popContext() 
    Remove the last pushed Context object, regardless of type. If there are no Context objects, no action is taken.
  void popContext(Context theContext) 
    Removes the specified Context object. If the specified Context object does not exist, the call will fail.
 public  void pushContext(Context newContext) 
    Add a Context object to the ContextManager. The object is added both to the holder list and to a stack for the specific type of Context.
 synchronized boolean setInterrupted(Context c) 
 public  void setLocaleFinder(LocaleFinder finder) 
    Set the locale for this context.
 public  void setMessageLocale(String localeID) throws StandardException