org.apache.derby.iapi.services.context
Class ContextManager

java.lang.Object
  extended byorg.apache.derby.iapi.services.context.ContextManager

public class ContextManager
extends java.lang.Object

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
(package private)  int activeCount
           
(package private)  java.lang.Thread activeThread
           
(package private)  java.util.Stack cmStack
           
private  java.util.Hashtable ctxTable
           
private  HeaderPrintWriter errorStream
           
private  ErrorStringBuilder errorStringBuilder
           
private  LocaleFinder finder
           
private  java.util.Stack holder
           
private  int logSeverityLevel
           
private  java.util.Locale messageLocale
           
(package private)  ContextService owningCsf
           
private  boolean shutdown
           
 
Constructor Summary
(package private) ContextManager(ContextService csf, HeaderPrintWriter stream)
          constructor specifying the hash table size and load factor for the hashed-by-id context stacks.
 
Method Summary
private  void checkInterrupt()
          Check to see if we have been interrupted.
 boolean cleanupOnError(java.lang.Throwable error)
           
private  void flushErrorString()
          Flush the built up error string to whereever it is supposed to go, and reset the error string
 Context getContext(java.lang.String contextId)
           
 java.util.Locale getMessageLocale()
           
 void popContext()
           
(package private)  void popContext(Context theContext)
           
 void pushContext(Context newContext)
           
private  boolean reportError(java.lang.Throwable t)
           
(package private)  boolean setInterrupted(Context c)
           
 void setLocaleFinder(LocaleFinder finder)
          Set the locale for this context.
 void setMessageLocale(java.lang.String localeID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

holder

private final java.util.Stack holder

messageLocale

private java.util.Locale messageLocale

ctxTable

private final java.util.Hashtable ctxTable

owningCsf

final ContextService owningCsf

logSeverityLevel

private int logSeverityLevel

errorStream

private HeaderPrintWriter errorStream

errorStringBuilder

private ErrorStringBuilder errorStringBuilder

shutdown

private boolean shutdown

finder

private LocaleFinder finder

cmStack

final java.util.Stack cmStack

activeThread

java.lang.Thread activeThread

activeCount

int activeCount
Constructor Detail

ContextManager

ContextManager(ContextService csf,
               HeaderPrintWriter stream)
constructor specifying the hash table size and load factor for the hashed-by-id context stacks.

Method Detail

pushContext

public void pushContext(Context newContext)

getContext

public Context getContext(java.lang.String contextId)
See Also:
getContext(java.lang.String)

popContext

public void popContext()
See Also:
popContext()

popContext

void popContext(Context theContext)

cleanupOnError

public boolean cleanupOnError(java.lang.Throwable error)
Returns:
true if the context manager is shutdown, false otherwise.

setInterrupted

boolean setInterrupted(Context c)

checkInterrupt

private void checkInterrupt()
Check to see if we have been interrupted. If we have then a ShutdownException will be thrown. This will be either the one passed to interrupt or a generic one if some outside source interrupted the thread.


setLocaleFinder

public void setLocaleFinder(LocaleFinder finder)
Set the locale for this context.


setMessageLocale

public void setMessageLocale(java.lang.String localeID)
                      throws StandardException
Throws:
StandardException

getMessageLocale

public java.util.Locale getMessageLocale()

flushErrorString

private void flushErrorString()
Flush the built up error string to whereever it is supposed to go, and reset the error string


reportError

private boolean reportError(java.lang.Throwable t)

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.