org.apache.commons.dbcp
クラス PoolingConnection

java.lang.Object
  拡張org.apache.commons.dbcp.AbandonedTrace
      拡張org.apache.commons.dbcp.DelegatingConnection
          拡張org.apache.commons.dbcp.PoolingConnection
すべての実装インタフェース:
Connection, org.apache.commons.pool.KeyedPoolableObjectFactory

public class PoolingConnection
extends DelegatingConnection
implements Connection, org.apache.commons.pool.KeyedPoolableObjectFactory

PreparedStatement をプールする DelegatingConnection です。

A {@link DelegatingConnection} that pools {@link PreparedStatement}s.

prepareStatement(java.lang.String) メソッドは毎回新たな PreparedStatement を生成せず、未使用のステートメントのプールから PreparedStatement を取り出します。 返された PreparedStatementStatement.close() メソッドは実際にはステートメントをクローズせず、プールに自身を戻します。(PoolablePreparedStatement を参照)

My {@link #prepareStatement} methods, rather than creating a new {@link PreparedStatement} each time, may actually pull the {@link PreparedStatement} from a pool of unused statements. The {@link PreparedStatement#close} method of the returned {@link PreparedStatement} doesn't actually close the statement, but rather returns it to my pool. (See {@link PoolablePreparedStatement}.)

作成者:
Rodney Waldhoff (rwaldhof@us.britannica.com)
関連項目:
PoolablePreparedStatement
翻訳者:
日置 聡
翻訳状況:
初稿(校正者募集中)
翻訳更新日:
2003/09/20

フィールドの概要
protected  org.apache.commons.pool.KeyedObjectPool _pstmtPool
          PreparedStatement のプールです。
 
クラス org.apache.commons.dbcp.DelegatingConnection から継承したフィールド
_closed, _conn
 
インタフェース java.sql.Connection から継承したフィールド
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
コンストラクタの概要
PoolingConnection(Connection c)
          コンストラクタ。
PoolingConnection(Connection c, org.apache.commons.pool.KeyedObjectPool pool)
          コンストラクタ。
 
メソッドの概要
 void activateObject(Object key, Object obj)
          PreparedStatement をアクティブにするための KeyedPoolableObjectFactory インターフェイスのメソッドです。
 void close()
          プール内の PreparedStatement をクローズ、開放し、内部に保持するコネクションをクローズします。
protected  Object createKey(String sql)
          渡された引数から PoolingConnection.PStmtKey を生成します。
protected  Object createKey(String sql, int resultSetType, int resultSetConcurrency)
          渡された引数から PoolingConnection.PStmtKey を生成します。
 void destroyObject(Object key, Object obj)
          PreparedStatement を破棄するための KeyedPoolableObjectFactory インターフェイスのメソッドです。
 Object makeObject(Object obj)
          PreparedStatement を生成するための KeyedPoolableObjectFactory インターフェイスのメソッドです。
protected  String normalizeSQL(String sql)
          渡されたSQLステートメントを標準化し、元と同じ意味を持つ標準的なフォームを生成します。
 void passivateObject(Object key, Object obj)
          PreparedStatement を非活性化するための KeyedPoolableObjectFactory インターフェイスのメソッドです。
 PreparedStatement prepareStatement(String sql)
          プールから PreparedStatement を生成、または取得します。
 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
          プールから PreparedStatement を生成、または取得します。
 String toString()
           
 boolean validateObject(Object key, Object obj)
          PreparedStatement をチェックするための KeyedPoolableObjectFactory インターフェイスのメソッドです。
 
クラス org.apache.commons.dbcp.DelegatingConnection から継承したメソッド
activate, checkOpen, clearWarnings, commit, createStatement, createStatement, getAutoCommit, getCatalog, getDelegate, getInnermostDelegate, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, passivate, prepareCall, prepareCall, rollback, setAutoCommit, setCatalog, setDelegate, setReadOnly, setTransactionIsolation, setTypeMap
 
クラス 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, wait, wait, wait
 
インタフェース java.sql.Connection から継承したメソッド
clearWarnings, commit, createStatement, createStatement, createStatement, getAutoCommit, getCatalog, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap
 

フィールドの詳細

_pstmtPool

protected org.apache.commons.pool.KeyedObjectPool _pstmtPool
PreparedStatement のプールです。
My pool of {@link PreparedStatement}s.

コンストラクタの詳細

PoolingConnection

public PoolingConnection(Connection c)
コンストラクタ。
Constructor.

パラメータ:
c - 内部に保持する Connection.
the underlying {@link Connection}.

PoolingConnection

public PoolingConnection(Connection c,
                         org.apache.commons.pool.KeyedObjectPool pool)
コンストラクタ。
Constructor.

パラメータ:
c - 内部に保持する Connection.
the underlying {@link Connection}.
メソッドの詳細

activateObject

public void activateObject(Object key,
                           Object obj)
PreparedStatement をアクティブにするための KeyedPoolableObjectFactory インターフェイスのメソッドです。 現状では何も行いません。
My {@link KeyedPoolableObjectFactory} method for activating {@link PreparedStatement}s. (Currently a no-op.)

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の activateObject
パラメータ:
key - 無視されます
ignored
obj - PreparedStatement
ignored

close

public void close()
           throws SQLException
プール内の PreparedStatement をクローズ、開放し、内部に保持するコネクションをクローズします。
Close and free all {@link PreparedStatement}s from my pool, and close my underlying connection.

定義:
インタフェース Connection 内の close
オーバーライド:
クラス DelegatingConnection 内の close
例外:
SQLException

createKey

protected Object createKey(String sql)
渡された引数から PoolingConnection.PStmtKey を生成します。
Create a {@link PoolingConnection.PStmtKey} for the given arguments.
}


createKey

protected Object createKey(String sql,
                           int resultSetType,
                           int resultSetConcurrency)
渡された引数から PoolingConnection.PStmtKey を生成します。
Create a {@link PoolingConnection.PStmtKey} for the given arguments.
}


destroyObject

public void destroyObject(Object key,
                          Object obj)
PreparedStatement を破棄するための KeyedPoolableObjectFactory インターフェイスのメソッドです。
My {@link KeyedPoolableObjectFactory} method for destroying {@link PreparedStatement}s.

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の destroyObject
パラメータ:
key - 無視されます
ignored
obj - 破棄する PreparedStatement
the {@link PreparedStatement} to be destroyed.

makeObject

public Object makeObject(Object obj)
PreparedStatement を生成するための KeyedPoolableObjectFactory インターフェイスのメソッドです。
My {@link KeyedPoolableObjectFactory} method for creating {@link PreparedStatement}s.

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の makeObject
パラメータ:
obj - PreparedStatement を生成するためのキー
the key for the {@link PreparedStatement} to be created

normalizeSQL

protected String normalizeSQL(String sql)
渡されたSQLステートメントを標準化し、元と同じ意味を持つ標準的なフォームを生成します。
Normalize the given SQL statement, producing a cannonical form that is semantically equivalent to the original.


passivateObject

public void passivateObject(Object key,
                            Object obj)
PreparedStatement を非活性化するための KeyedPoolableObjectFactory インターフェイスのメソッドです。 現状では PreparedStatement.clearParameters() を行います。
My {@link KeyedPoolableObjectFactory} method for passivating {@link PreparedStatement}s. Currently invokes {@link PreparedStatement#clearParameters}.

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の passivateObject
パラメータ:
key - 無視されます
ignored
obj - PreparedStatement
a {@link PreparedStatement}

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
プールから PreparedStatement を生成、または取得します。
Create or obtain a {@link PreparedStatement} from my pool.

定義:
インタフェース Connection 内の prepareStatement
オーバーライド:
クラス DelegatingConnection 内の prepareStatement
戻り値:
PoolablePreparedStatement
a {@link PoolablePreparedStatement}
例外:
SQLException

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
プールから PreparedStatement を生成、または取得します。
Create or obtain a {@link PreparedStatement} from my pool.

定義:
インタフェース Connection 内の prepareStatement
オーバーライド:
クラス DelegatingConnection 内の prepareStatement
戻り値:
PoolablePreparedStatement
a {@link PoolablePreparedStatement}
例外:
SQLException

toString

public String toString()

validateObject

public boolean validateObject(Object key,
                              Object obj)
PreparedStatement をチェックするための KeyedPoolableObjectFactory インターフェイスのメソッドです。
My {@link KeyedPoolableObjectFactory} method for validating
PreparedStatements.}

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の validateObject
パラメータ:
key - 無視されます
ignored
obj - 無視されます
ignored
戻り値:
true


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