Package org.apache.derby.impl.db
Class DatabaseContextImpl
- java.lang.Object
-
- org.apache.derby.iapi.services.context.ContextImpl
-
- org.apache.derby.impl.db.DatabaseContextImpl
-
- All Implemented Interfaces:
DatabaseContext
,Context
final class DatabaseContextImpl extends ContextImpl implements DatabaseContext
A context that shutdowns down the database on a databsae exception.
-
-
Field Summary
Fields Modifier and Type Field Description private Database
db
-
Fields inherited from interface org.apache.derby.iapi.db.DatabaseContext
CONTEXT_ID
-
-
Constructor Summary
Constructors Constructor Description DatabaseContextImpl(ContextManager cm, Database db)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanupOnError(java.lang.Throwable t)
Contexts will be passed errors that are caught by the outer system when they are serious enough to require corrective action.boolean
equals(java.lang.Object other)
private static ContextService
getContextService()
Privileged lookup of the ContextService.Database
getDatabase()
private static ModuleFactory
getMonitor()
Privileged Monitor lookup.int
hashCode()
-
Methods inherited from class org.apache.derby.iapi.services.context.ContextImpl
appendErrorInfo, getContextManager, getIdName, isLastHandler, popMe, pushMe
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.services.context.Context
getContextManager, getIdName, isLastHandler, popMe, pushMe
-
-
-
-
Field Detail
-
db
private final Database db
-
-
Constructor Detail
-
DatabaseContextImpl
DatabaseContextImpl(ContextManager cm, Database db)
-
-
Method Detail
-
cleanupOnError
public void cleanupOnError(java.lang.Throwable t)
Description copied from interface:Context
Contexts will be passed errors that are caught by the outer system when they are serious enough to require corrective action. They will be told what the error is, so that they can react appropriately. Most of the time, the contexts will react by either doing nothing or by removing themselves from the context manager. If there are no other references to the context, removing itself from the manager equates to freeing it.
On an exception that is session severity or greater the Context must push itself off the stack. This is to ensure that after a session has been closed there are no Contexts on the stack that potentially hold references to objects, thus delaying their garbage collection.Contexts must release all their resources before removing themselves from their context manager.
The context manager will "unwind" the contexts during cleanup in the reverse order they were placed on its global stack.
If error is an instance of StandardException then an implementation of this method may throw a new exception if and only if the new exception is an instance of StandardException that is more severe than the original error or the new exception is a not an instance of StandardException (e.g java.lang.NullPointerException).
- Specified by:
cleanupOnError
in interfaceContext
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getDatabase
public Database getDatabase()
- Specified by:
getDatabase
in interfaceDatabaseContext
-
getContextService
private static ContextService getContextService()
Privileged lookup of the ContextService. Must be private so that user code can't call this entry point.
-
getMonitor
private static ModuleFactory getMonitor()
Privileged Monitor lookup. Must be private so that user code can't call this entry point.
-
-