public class ContextManager
extends java.lang.Object
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.
Modifier and Type | Class | Description |
---|---|---|
private static class |
ContextManager.CtxStack |
The CtxStack implement a stack on top of an ArrayList (to avoid
the inherent overhead associated with java.util.Stack which is
built on top of java.util.Vector, which is fully
synchronized).
|
Modifier and Type | Field | Description |
---|---|---|
(package private) int |
activeCount |
Count of the number of setCurrentContextManager calls
by a single thread, for nesting situations with a single
active Contextmanager.
|
(package private) java.lang.Thread |
activeThread |
The thread that owns this ContextManager, set by
ContextService.setCurrentContextManager and reset
by resetCurrentContextManager.
|
private java.util.HashMap<java.lang.String,ContextManager.CtxStack> |
ctxTable |
HashMap that holds the Context objects.
|
private HeaderPrintWriter |
errorStream |
|
private ErrorStringBuilder |
errorStringBuilder |
|
private int |
extDiagSeverityLevel |
|
private LocaleFinder |
finder |
|
private java.util.ArrayList<Context> |
holder |
List of all Contexts
|
private int |
logSeverityLevel |
|
private java.util.Locale |
messageLocale |
|
(package private) ContextService |
owningCsf |
|
private boolean |
shutdown |
|
private java.lang.String |
threadDump |
Constructor | Description |
---|---|
ContextManager(ContextService csf,
HeaderPrintWriter stream) |
Constructs a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
private void |
checkInterrupt() |
Check to see if we have been interrupted.
|
boolean |
cleanupOnError(java.lang.Throwable error,
boolean diagActive) |
clean up error and print it to derby.log.
|
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) |
Obtain the last pushed Context object of the type indicated by
the contextId argument.
|
java.util.List<Context> |
getContextStack(java.lang.String contextId) |
Return an unmodifiable list reference to the ArrayList backing
CtxStack object for this type of Contexts.
|
int |
getErrorSeverity(java.lang.Throwable error) |
return the severity of the exception.
|
java.util.Locale |
getMessageLocale() |
|
(package private) boolean |
isEmpty() |
Is the ContextManager empty containing no Contexts.
|
void |
popContext() |
Remove the last pushed Context object, regardless of type.
|
(package private) void |
popContext(Context theContext) |
Removes the specified Context object.
|
void |
pushContext(Context newContext) |
Add a Context object to the ContextManager.
|
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) |
private final java.util.HashMap<java.lang.String,ContextManager.CtxStack> ctxTable
pushContext(Context)
private final java.util.ArrayList<Context> holder
private java.util.Locale messageLocale
final ContextService owningCsf
private int logSeverityLevel
private int extDiagSeverityLevel
private HeaderPrintWriter errorStream
private ErrorStringBuilder errorStringBuilder
private java.lang.String threadDump
private boolean shutdown
private LocaleFinder finder
java.lang.Thread activeThread
int activeCount
ContextService.threadContextList
ContextManager(ContextService csf, HeaderPrintWriter stream)
csf
- the ContextService owning this ContextManagerstream
- error stream for reporting errorspublic void pushContext(Context newContext)
newContext
- the new Context objectpublic Context getContext(java.lang.String contextId)
contextId
- a String identifying the type of Contextpublic void popContext()
void popContext(Context theContext)
theContext
- the Context object to remove.final boolean isEmpty()
public final java.util.List<Context> getContextStack(java.lang.String contextId)
contextId
- the type of Context stack to return.GenericLanguageConnectionContext.resetSavepoints()
,
StatementContext.resetSavePoint()
public boolean cleanupOnError(java.lang.Throwable error, boolean diagActive)
error
- the error we want to clean updiagActive
- true if extended diagnostics should be considered,
false not interested of extended diagnostic informationboolean setInterrupted(Context c)
private void checkInterrupt()
public void setLocaleFinder(LocaleFinder finder)
public void setMessageLocale(java.lang.String localeID) throws StandardException
StandardException
public java.util.Locale getMessageLocale()
private void flushErrorString()
private boolean reportError(java.lang.Throwable t)
public int getErrorSeverity(java.lang.Throwable error)
error
- - Throwable errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.