Methods Summary |
---|
void | checkConfiguredQueryTimeout(WrappedStatement ws)
if (mc == null || dataSource == null)
return;
int timeout = 0;
// Use the transaction timeout
if (mc.isTransactionQueryTimeout())
timeout = dataSource.getTimeLeftBeforeTransactionTimeout();
// Look for a configured value
if (timeout <= 0)
timeout = mc.getQueryTimeout();
if (timeout > 0)
ws.setQueryTimeout(timeout);
|
protected java.sql.SQLException | checkException(java.lang.Throwable t)The base checkException method rethrows the supplied exception, informing
the ManagedConnection of the error. Subclasses may override this to
filter exceptions based on their severity.
if (mc != null)
mc.connectionError(t);
if (t instanceof SQLException)
throw (SQLException) t;
else
throw new NestedSQLException("Error", t);
|
protected void | checkStatus()The checkStatus method checks that the handle has not been closed and
that it is associated with a managed connection.
if (closed)
throw new SQLException("Connection handle has been closed and is unusable");
if (mc == null)
throw new SQLException("Connection handle is not currently associated with a ManagedConnection");
|
void | checkTransaction()
checkStatus();
mc.checkTransaction();
|
public void | clearWarnings()
checkTransaction();
try
{
mc.getConnection().clearWarnings();
}
catch (Throwable t)
{
throw checkException(t);
}
|
public void | close()
closed = true;
if (mc != null)
{
if (trackStatements != BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
{
synchronized (this)
{
if (statements != null)
{
for (Iterator i = statements.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
WrappedStatement ws = (WrappedStatement) entry.getKey();
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT)
{
Throwable stackTrace = (Throwable) entry.getValue();
log.warn("Closing a statement you left open, please do your own housekeeping", stackTrace);
}
try
{
ws.internalClose();
}
catch (Throwable t)
{
log.warn("Exception trying to close statement:", t);
}
}
}
}
}
mc.closeHandle(this);
}
mc = null;
dataSource = null;
|
public void | commit()
checkTransaction();
mc.jdbcCommit();
|
public java.sql.Statement | createStatement(int resultSetType, int resultSetConcurrency)
checkTransaction();
try
{
return new WrappedStatement(this, mc.getConnection().createStatement(resultSetType, resultSetConcurrency));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.Statement | createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
checkTransaction();
try
{
return new WrappedStatement(this, mc.getConnection()
.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.Statement | createStatement()
checkTransaction();
try
{
return new WrappedStatement(this, mc.getConnection().createStatement());
}
catch (Throwable t)
{
throw checkException(t);
}
|
public boolean | getAutoCommit()
checkStatus();
return mc.isJdbcAutoCommit();
|
public java.lang.String | getCatalog()
checkTransaction();
try
{
return mc.getConnection().getCatalog();
}
catch (Throwable t)
{
throw checkException(t);
}
|
public WrapperDataSource | getDataSource()
return dataSource;
|
public int | getHoldability()
checkTransaction();
try
{
return mc.getConnection().getHoldability();
}
catch (Throwable t)
{
throw checkException(t);
}
|
org.jboss.logging.Logger | getLogger()
return log;
|
public java.sql.DatabaseMetaData | getMetaData()
checkTransaction();
try
{
return mc.getConnection().getMetaData();
}
catch (Throwable t)
{
throw checkException(t);
}
|
int | getTrackStatements()
return trackStatements;
|
public int | getTransactionIsolation()
checkStatus();
return mc.getJdbcTransactionIsolation();
|
public java.util.Map | getTypeMap()
checkTransaction();
try
{
return mc.getConnection().getTypeMap();
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.Connection | getUnderlyingConnection()
checkTransaction();
return mc.getConnection();
|
public java.sql.SQLWarning | getWarnings()
checkTransaction();
try
{
return mc.getConnection().getWarnings();
}
catch (Throwable t)
{
throw checkException(t);
}
|
public boolean | isClosed()
return closed;
|
public boolean | isReadOnly()
checkStatus();
return mc.isJdbcReadOnly();
|
public java.lang.String | nativeSQL(java.lang.String sql)
checkTransaction();
try
{
return mc.getConnection().nativeSQL(sql);
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.CallableStatement | prepareCall(java.lang.String sql)
checkTransaction();
try
{
return new WrappedCallableStatement(this, mc.prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.CallableStatement | prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
checkTransaction();
try
{
return new WrappedCallableStatement(this, mc.prepareCall(sql, resultSetType, resultSetConcurrency));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.CallableStatement | prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
checkTransaction();
try
{
return new WrappedCallableStatement(this, mc.getConnection()
.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.prepareStatement(sql, resultSetType, resultSetConcurrency));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.getConnection()
.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql, int autoGeneratedKeys)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, autoGeneratedKeys));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql, int[] columnIndexes)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, columnIndexes));
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.PreparedStatement | prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
checkTransaction();
try
{
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, columnNames));
}
catch (Throwable t)
{
throw checkException(t);
}
|
void | registerStatement(WrappedStatement ws)
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this)
{
if (statements == null)
statements = new HashMap();
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT)
statements.put(ws, new Throwable("STACKTRACE"));
else
statements.put(ws, null);
}
|
public void | releaseSavepoint(java.sql.Savepoint savepoint)
checkTransaction();
try
{
mc.getConnection().releaseSavepoint(savepoint);
}
catch (Throwable t)
{
throw checkException(t);
}
|
public void | rollback()
checkTransaction();
mc.jdbcRollback();
|
public void | rollback(java.sql.Savepoint savepoint)
checkTransaction();
mc.jdbcRollback(savepoint);
|
public void | setAutoCommit(boolean autocommit)
checkStatus();
mc.setJdbcAutoCommit(autocommit);
|
public void | setCatalog(java.lang.String catalog)
checkTransaction();
try
{
mc.getConnection().setCatalog(catalog);
}
catch (Throwable t)
{
throw checkException(t);
}
|
protected void | setDataSource(WrapperDataSource dataSource)
this.dataSource = dataSource;
|
public void | setHoldability(int holdability)
checkTransaction();
try
{
mc.getConnection().setHoldability(holdability);
}
catch (Throwable t)
{
throw checkException(t);
}
|
void | setManagedConnection(BaseWrapperManagedConnection mc)
this.mc = mc;
if (mc != null)
trackStatements = mc.getTrackStatements();
|
public void | setReadOnly(boolean readOnly)
checkStatus();
mc.setJdbcReadOnly(readOnly);
|
public java.sql.Savepoint | setSavepoint()
checkTransaction();
try
{
return mc.getConnection().setSavepoint();
}
catch (Throwable t)
{
throw checkException(t);
}
|
public java.sql.Savepoint | setSavepoint(java.lang.String name)
checkTransaction();
try
{
return mc.getConnection().setSavepoint(name);
}
catch (Throwable t)
{
throw checkException(t);
}
|
public void | setTransactionIsolation(int isolationLevel)
checkStatus();
mc.setJdbcTransactionIsolation(isolationLevel);
|
public void | setTypeMap(java.util.Map typeMap)
checkTransaction();
try
{
mc.getConnection().setTypeMap(typeMap);
}
catch (Throwable t)
{
throw checkException(t);
}
|
void | unregisterStatement(WrappedStatement ws)
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this)
{
if (statements != null)
statements.remove(ws);
}
|