org.apache.commons.dbcp
クラス DelegatingConnection

java.lang.Object
  拡張org.apache.commons.dbcp.AbandonedTrace
      拡張org.apache.commons.dbcp.DelegatingConnection
すべての実装インタフェース:
Connection
直系の既知のサブクラス:
PoolableConnection, PoolingConnection

public class DelegatingConnection
extends AbandonedTrace
implements Connection

基盤となる Connection の委譲を行う実装です。

A base delegating implementation of {@link Connection}.

Connection インターフェイスの持つ全てのメソッドは、この コンストラクタにて渡された Connection がアクティブかどうかをチェックして Connection の対応するメソッドを単純にコールします。

All of the methods from the {@link Connection} interface simply check to see that the {@link Connection} is active, and call the corresponding method on the "delegate" provided in my constructor.

Connection の追跡とConnection を生成したコードのログを行うために AbandonedTrace を継承します。 Connection の追跡を行うことにより、AbandonedObjectPool がこの Connection をクローズできるようになります。 また、このコネクションのプールが保持しているコネクションを使い切りそうで removeAbandonedTimeout のチェックに引っかからなければ再利用することができます。

Extends AbandonedTrace to implement Connection tracking and logging of code which created the Connection. Tracking the Connection ensures that the AbandonedObjectPool can close this connection and recycle it if its pool of connections is nearing exhaustion and this connection's last usage is older than the removeAbandonedTimeout.

バージョン:
$Id: DelegatingConnection.java,v 1.1.1.1 2004/02/13 10:02:03 hioki Exp $
作成者:
Rodney Waldhoff, Glenn L. Nielsen, James House (james@interobjective.com)
翻訳者:
日置 聡
翻訳状況:
初稿(校正者募集中)
翻訳更新日:
2003/09/17

フィールドの概要
protected  boolean _closed
           
protected  Connection _conn
          処理の委託先となる Connectionです。
 
インタフェース java.sql.Connection から継承したフィールド
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
コンストラクタの概要
DelegatingConnection(Connection c)
          AbandonedObjectPool 内に保持されるこの Connection をトレースする Connection のラッパーを生成します。
DelegatingConnection(Connection c, AbandonedConfig config)
          生成されたままクローズされなかった Statement を Connection がクローズされた際にクローズすることのできる Connection のラッパーを生成します。
 
メソッドの概要
protected  void activate()
           
protected  void checkOpen()
           
 void clearWarnings()
           
 void close()
          内部に保持するコネクションをクローズし、明示的にクローズされなかった Statement をクローズします。
 void commit()
           
 Statement createStatement()
           
 Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 boolean getAutoCommit()
           
 String getCatalog()
           
 Connection getDelegate()
          内部に保持する Connection を返します。
 Connection getInnermostDelegate()
          内部に保持する ConnectionDelegatingConnection でない場合にはその Connection を返し、それ以外の場合には再帰的に getDelegate() をコールします。
 DatabaseMetaData getMetaData()
           
 int getTransactionIsolation()
           
 Map getTypeMap()
           
 SQLWarning getWarnings()
           
 boolean isClosed()
           
 boolean isReadOnly()
           
 String nativeSQL(String sql)
           
protected  void passivate()
           
 CallableStatement prepareCall(String sql)
           
 CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency)
           
 PreparedStatement prepareStatement(String sql)
           
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
           
 void rollback()
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(String catalog)
           
 void setDelegate(Connection c)
          処理の委託先となる Connection を設定します。
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(Map map)
           
 
クラス org.apache.commons.dbcp.AbandonedTrace から継承したメソッド
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
インタフェース java.sql.Connection から継承したメソッド
createStatement, getHoldability, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setHoldability, setSavepoint, setSavepoint
 

フィールドの詳細

_closed

protected boolean _closed

_conn

protected Connection _conn
処理の委託先となる Connectionです。
My delegate {@link Connection}.

コンストラクタの詳細

DelegatingConnection

public DelegatingConnection(Connection c)
AbandonedObjectPool 内に保持されるこの Connection をトレースする Connection のラッパーを生成します。
Create a wrapper for the Connectin which traces this Connection in the AbandonedObjectPool.

パラメータ:
c - 全ての処理の委託先となる Connection
the {@link Connection} to delegate all calls to.

DelegatingConnection

public DelegatingConnection(Connection c,
                            AbandonedConfig config)
生成されたままクローズされなかった Statement を Connection がクローズされた際にクローズすることのできる Connection のラッパーを生成します。
Create a wrapper for the Connection which traces the Statements created so that any unclosed Statements can be closed when this Connection is closed.

パラメータ:
c - 全ての処理の委託先となる Connection
the {@link Connection} to delegate all calls to.
config - 破棄されたオブジェクトをトレースするための設定
the configuration for tracing abandoned objects
メソッドの詳細

activate

protected void activate()

checkOpen

protected void checkOpen()
                  throws SQLException
例外:
SQLException

clearWarnings

public void clearWarnings()
                   throws SQLException
定義:
インタフェース Connection 内の clearWarnings
例外:
SQLException

close

public void close()
           throws SQLException
内部に保持するコネクションをクローズし、明示的にクローズされなかった Statement をクローズします。
Closes the underlying connection, and close any Statements that were not explicitly closed.

定義:
インタフェース Connection 内の close
例外:
SQLException

commit

public void commit()
            throws SQLException
定義:
インタフェース Connection 内の commit
例外:
SQLException

createStatement

public Statement createStatement()
                          throws SQLException
定義:
インタフェース Connection 内の createStatement
例外:
SQLException

createStatement

public Statement createStatement(int resultSetType,
                                 int resultSetConcurrency)
                          throws SQLException
定義:
インタフェース Connection 内の createStatement
例外:
SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws SQLException
定義:
インタフェース Connection 内の getAutoCommit
例外:
SQLException

getCatalog

public String getCatalog()
                  throws SQLException
定義:
インタフェース Connection 内の getCatalog
例外:
SQLException

getDelegate

public Connection getDelegate()
内部に保持する Connection を返します。
Returns my underlying {@link Connection}.

戻り値:
内部に保持する Connection
my underlying {@link Connection}.

getInnermostDelegate

public Connection getInnermostDelegate()
内部に保持する ConnectionDelegatingConnection でない場合にはその Connection を返し、それ以外の場合には再帰的に getDelegate() をコールします。
If my underlying {@link Connection} is not a DelegatingConnection, returns it, otherwise recursively invokes this method on my delegate.

従ってこのメソッドは DelegatingConnection ではない根本の処理の委託先となる Connection を返し、 DelegatingConnection の連鎖の中に処理の委託先が見つからない場合には null を返します。

Hence this method will return the first delegate that is not a DelegatingConnection, or null when no non-DelegatingConnection delegate can be found by transversing this chain.

このメソッドはネストした DelegatingConnection から 本来の Connection を取得したい場合に有用です。

This method is useful when you may have nested DelegatingConnections, and you want to make sure to obtain a "genuine" {@link Connection}.


getMetaData

public DatabaseMetaData getMetaData()
                             throws SQLException
定義:
インタフェース Connection 内の getMetaData
例外:
SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws SQLException
定義:
インタフェース Connection 内の getTransactionIsolation
例外:
SQLException

getTypeMap

public Map getTypeMap()
               throws SQLException
定義:
インタフェース Connection 内の getTypeMap
例外:
SQLException

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
定義:
インタフェース Connection 内の getWarnings
例外:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
定義:
インタフェース Connection 内の isClosed
例外:
SQLException

isReadOnly

public boolean isReadOnly()
                   throws SQLException
定義:
インタフェース Connection 内の isReadOnly
例外:
SQLException

nativeSQL

public String nativeSQL(String sql)
                 throws SQLException
定義:
インタフェース Connection 内の nativeSQL
例外:
SQLException

passivate

protected void passivate()
                  throws SQLException
例外:
SQLException

prepareCall

public CallableStatement prepareCall(String sql)
                              throws SQLException
定義:
インタフェース Connection 内の prepareCall
例外:
SQLException

prepareCall

public CallableStatement prepareCall(String sql,
                                     int resultSetType,
                                     int resultSetConcurrency)
                              throws SQLException
定義:
インタフェース Connection 内の prepareCall
例外:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
定義:
インタフェース Connection 内の prepareStatement
例外:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
定義:
インタフェース Connection 内の prepareStatement
例外:
SQLException

rollback

public void rollback()
              throws SQLException
定義:
インタフェース Connection 内の rollback
例外:
SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws SQLException
定義:
インタフェース Connection 内の setAutoCommit
例外:
SQLException

setCatalog

public void setCatalog(String catalog)
                throws SQLException
定義:
インタフェース Connection 内の setCatalog
例外:
SQLException

setDelegate

public void setDelegate(Connection c)
処理の委託先となる Connection を設定します。
Sets my delegate.


setReadOnly

public void setReadOnly(boolean readOnly)
                 throws SQLException
定義:
インタフェース Connection 内の setReadOnly
例外:
SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws SQLException
定義:
インタフェース Connection 内の setTransactionIsolation
例外:
SQLException

setTypeMap

public void setTypeMap(Map map)
                throws SQLException
定義:
インタフェース Connection 内の setTypeMap
例外:
SQLException


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation