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 です。

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

作成者:
Rodney Waldhoff (rwaldhof@us.britannica.com)
関連項目:
PoolablePreparedStatement
翻訳者:
日置 聡

フィールドの概要
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 のプールです。

コンストラクタの詳細

PoolingConnection

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

パラメータ:
c - 内部に保持する Connection.

PoolingConnection

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

パラメータ:
c - 内部に保持する Connection.
メソッドの詳細

activateObject

public void activateObject(Object key,
                           Object obj)
PreparedStatement をアクティブにするための KeyedPoolableObjectFactory インターフェイスのメソッドです。 現状では何も行いません。

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

close

public void close()
           throws SQLException
プール内の PreparedStatement をクローズ、開放し、内部に保持するコネクションをクローズします。

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

createKey

protected Object createKey(String sql)
渡された引数から PoolingConnection.PStmtKey を生成します。 }


createKey

protected Object createKey(String sql,
                           int resultSetType,
                           int resultSetConcurrency)
渡された引数から PoolingConnection.PStmtKey を生成します。 }


destroyObject

public void destroyObject(Object key,
                          Object obj)
PreparedStatement を破棄するための KeyedPoolableObjectFactory インターフェイスのメソッドです。

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

makeObject

public Object makeObject(Object obj)
PreparedStatement を生成するための KeyedPoolableObjectFactory インターフェイスのメソッドです。

定義:
インタフェース org.apache.commons.pool.KeyedPoolableObjectFactory 内の makeObject
パラメータ:
obj - PreparedStatement を生成するためのキー

normalizeSQL

protected String normalizeSQL(String sql)
渡されたSQLステートメントを標準化し、元と同じ意味を持つ標準的なフォームを生成します。


passivateObject

public void passivateObject(Object key,
                            Object obj)
PreparedStatement を非活性化するための KeyedPoolableObjectFactory インターフェイスのメソッドです。 現状では PreparedStatement.clearParameters() を行います。

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

prepareStatement

public PreparedStatement prepareStatement(String sql)
                                   throws SQLException
プールから PreparedStatement を生成、または取得します。

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

prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException
プールから PreparedStatement を生成、または取得します。

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

toString

public String toString()

validateObject

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

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


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