org.apache.derby.iapi.services.context
Class ContextManager
- java.lang.Object
-
- org.apache.derby.iapi.services.context.ContextManager
-
public class ContextManager extends java.lang.ObjectThe 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancleanupOnError(java.lang.Throwable error, boolean diagActive)clean up error and print it to derby.log.ContextgetContext(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.intgetErrorSeverity(java.lang.Throwable error)return the severity of the exception.java.util.LocalegetMessageLocale()voidpopContext()Remove the last pushed Context object, regardless of type.voidpushContext(Context newContext)Add a Context object to the ContextManager.voidsetLocaleFinder(LocaleFinder finder)Set the locale for this context.voidsetMessageLocale(java.lang.String localeID)
-
-
-
Method Detail
-
pushContext
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.- Parameters:
newContext- the new Context object
-
getContext
public Context getContext(java.lang.String contextId)
Obtain the last pushed Context object of the type indicated by the contextId argument.- Parameters:
contextId- a String identifying the type of Context- Returns:
- The Context object with the corresponding contextId, or null if not found
-
popContext
public void popContext()
Remove the last pushed Context object, regardless of type. If there are no Context objects, no action is taken.
-
getContextStack
public final 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. 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.- Parameters:
contextId- the type of Context stack to return.- Returns:
- an unmodifiable "view" of the ArrayList backing the stack
- See Also:
GenericLanguageConnectionContext.resetSavepoints(),StatementContext.resetSavePoint()
-
cleanupOnError
public boolean cleanupOnError(java.lang.Throwable error, boolean diagActive)clean up error and print it to derby.log. Extended diagnosis including thread dump to derby.log and javaDump if available, will print if the database is active and severity is greater than or equals to SESSTION_SEVERITY or as configured by derby.stream.error.extendedDiagSeverityLevel property- Parameters:
error- the error we want to clean updiagActive- true if extended diagnostics should be considered, false not interested of extended diagnostic information- Returns:
- true if the context manager is shutdown, false otherwise.
-
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()
-
getErrorSeverity
public int getErrorSeverity(java.lang.Throwable error)
return the severity of the exception. Currently, this method does not determine a severity that is not StandardException or SQLException.- Parameters:
error- - Throwable error- Returns:
- int vendorcode/severity for the Throwable error - error/exception to extract vendorcode/severity. For error that we can not get severity, NO_APPLICABLE_SEVERITY will return.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG