org.apache.derby.impl.jdbc
Class EmbedConnectionContext
java.lang.Object
org.apache.derby.iapi.services.context.ContextImpl
org.apache.derby.impl.jdbc.EmbedConnectionContext
- All Implemented Interfaces:
- ConnectionContext, Context
- public class EmbedConnectionContext
- extends ContextImpl
- implements ConnectionContext
- Author:
- djd
Field Summary |
private java.lang.ref.SoftReference |
connRef
We hold a soft reference to the connection so that when the application
releases its reference to the Connection without closing it, its finalize
method will be called, which will then close the connection. |
Fields inherited from class org.apache.derby.iapi.services.context.ContextImpl |
|
Method Summary |
void |
cleanupOnError(java.lang.Throwable error)
Contexts will be passed errors that are caught
by the outer system when they are serious enough
to require corrective action. |
java.sql.Connection |
getNestedConnection(boolean internal)
Get a connection equivalent to the call
DriverManager.getConnection("jdbc:default:connection");
|
java.sql.ResultSet |
getResultSet(ResultSet executionResultSet)
Get a jdbc ResultSet based on the execution ResultSet. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
connRef
private java.lang.ref.SoftReference connRef
- We hold a soft reference to the connection so that when the application
releases its reference to the Connection without closing it, its finalize
method will be called, which will then close the connection. If a direct
reference is used here, such a Connection will never be closed or garbage
collected as modules hold onto the ContextManager and thus there would
be a direct reference through this object.
EmbedConnectionContext
EmbedConnectionContext(ContextManager cm,
EmbedConnection conn)
cleanupOnError
public void cleanupOnError(java.lang.Throwable error)
- 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.
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 interface Context
getNestedConnection
public java.sql.Connection getNestedConnection(boolean internal)
throws java.sql.SQLException
- Get a connection equivalent to the call
DriverManager.getConnection("jdbc:default:connection");
- Specified by:
getNestedConnection
in interface ConnectionContext
- Throws:
java.sql.SQLException
- Parent connection has been closed.
getResultSet
public java.sql.ResultSet getResultSet(ResultSet executionResultSet)
throws java.sql.SQLException
- Get a jdbc ResultSet based on the execution ResultSet.
- Specified by:
getResultSet
in interface ConnectionContext
- Parameters:
executionResultSet
- a result set as gotten from execution
- Throws:
java.sql.SQLException
- on error
Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.