org.apache.commons.dbcp.jdbc2pool
クラス Jdbc2PoolDataSource
java.lang.Object
org.apache.commons.dbcp.jdbc2pool.Jdbc2PoolDataSource
- すべての実装インタフェース:
- DataSource, ObjectFactory, Referenceable, Serializable
- public class Jdbc2PoolDataSource
- extends Object
- implements DataSource, Referenceable, Serializable, ObjectFactory
J2EE環境でのデプロイに適切なプーリングを行う DataSource です。
さまざまな設定オプションを持ちます。
複数のユーザがそれぞれの Connection の最大数等のパラメータの共通セットを持つことができます。
このプールはデプロイする環境がプロパティのマッピングによる初期化をサポートする場合、ユーザ毎の個々のプールを持つ機能をサポートします。
従って、例えば管理者、または書き込みアクセスのプールに対して一定の Connection
を保証し、読み込み専用の接続の数とは切り離して管理することができます。
A pooling DataSource appropriate for deployment within
J2EE environment. There are many configuration options. Multiple users
can share a common set of parameters, such as a single maximum number
of Connections. The pool can also support individual pools per user, if the
deployment environment can support initialization of mapped properties.
So for example, a pool of admin or write-access Connections can be
guaranteed a certain number of connections, separate from a maximum
set for read-only connections.
J2EE コンテナは普通 DataSource を初期化するためのいくつかの方法を提供し、
初期化の為の属性は bean のゲッタ/セッタにて参照され、JNDI を経てデプロイされます。
これはプールされた論理的なデータベースへの接続の供給元としてとしてアプリケーションから利用することができます。
プールは物理的な接続の供給元を必要とします。
この供給元となる ConnectionPoolDataSource は JNDI を介してルックアップを行う
setDataSourceName(String) にて指定することができます。
A J2EE container will normally provide some method of initializing the
DataSource whose attributes are presented
as bean getters/setters and then deploying it via JNDI. It is then
available to an application as a source of pooled logical connections to
the database. The pool needs a source of physical connections. This
source is in the form of a ConnectionPoolDataSource that
can be specified via the {@link #setDataSourceName(String)} used to
lookup the source via JNDI.
普通、 Jdbc2PoolDataSource は JNDI 環境で使用されますが、
DriverAdapterCPDS は他の bean と同じようにインスタンス化、初期化されます。
この場合、 ConnectionPoolDataSource も同じような方法でインスタンス化されます。
この(コネクションの)供給元は setConnectionPoolDataSource(ConnectionPoolDataSource)
メソッドを使用して直接このプールにアタッチされます。
Although normally used within a JNDI environment, Jdbc2PoolDataSource
can be instantiated and initialized as any bean. In this case the
ConnectionPoolDataSource will likely be instantiated in
a similar manner. The source can then be attached directly to this
pool using the
{@link #setConnectionPoolDataSource(ConnectionPoolDataSource)} method.
この DataSource が JNDI を経由して複数の要求を受けた場合、ルックアップ毎に状態を保持します。
また、この複数のインスタンスはそれぞれ(コネクションの)供給元に異なる
ConnectionPoolDataSource を使用してデプロイされます。
If this DataSource
is requested via JNDI multiple times, it maintains
state between lookups. Also, multiple instances can be deployed using
different backend ConnectionPoolDataSource sources.
dbcp.cpdsadapter パッケージには Jdbc2PoolDataSource が使用することのできる
ConnectionPoolDataSource の実装は持たないが Driver
は提供されている JDBC ドライバ実装のためのアダプタ
DriverAdapterCPDS が含まれます。
The dbcp package contains an adapter,
{@link org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS},
that can be used to allow the
use of Jdbc2PoolDataSource with jdbc driver implementations that
do not supply a ConnectionPoolDataSource, but still
provide a {@link java.sql.Driver} implementation.
パッケージドキュメント には
catalina と JNDI を使用した場合と JNDI を使用しない場合の使用例が含まれています。
The
package documentation contains an
example using catalina and JNDI and it also contains a non-JNDI example.
- バージョン:
- $Id: Jdbc2PoolDataSource.java,v 1.1.1.1 2004/02/13 10:02:03 hioki Exp $
- 作成者:
- John D. McNally
- 関連項目:
- 直列化された形式
- 翻訳者:
- 日置 聡
- 翻訳状況:
- 初稿(校正者募集中)
- 翻訳更新日:
- 2003/09/12
|
メソッドの概要 |
Connection |
getConnection()
データベースとの接続の確立を試みます。
|
Connection |
getConnection(String username,
String password)
データベースとの接続の確立を試みます。
|
ConnectionPoolDataSource |
getConnectionPoolDataSource()
connectionPoolDataSource の値を取得します。
|
String |
getDataSourceName()
このプールの内部の ConnectionPoolDataSource の名前を取得します。
|
int |
getDefaultMaxActive()
このプールから1度に割り当てることのできるアクティブなコネクションの最大数です。
|
int |
getDefaultMaxIdle()
このプール内で開放されずにアイドル状態でいられるアクティブなコネクションの最大数です。
|
int |
getDefaultMaxWait()
利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
|
String |
getDescription()
記述情報(Description)の値を取得します。
|
String |
getJndiEnvironment(String key)
JNDI InitialContext のインスタンス化の際に使用される jndiEnvironment の値を取得します。
|
int |
getLoginTimeout()
loginTimeout の値を取得します。
|
PrintWriter |
getLogWriter()
logWriter の値を取得します。
|
int |
getMinEvictableIdleTimeMillis()
アイドル状態のオブジェクトがプール内に居られる最短時間を返します。
|
int |
getNumTestsPerEvictionRun()
アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするオブジェクトの数を返します。
|
Object |
getObjectInstance(Object refObj,
Name name,
Context context,
Hashtable env)
このクラスのインスタンスを生成するための ObjectFactory の実装です。
|
Boolean |
getPerUserDefaultAutoCommit(String key)
ユーザ毎のオートコミットのデフォルトの設定値を取得します。
|
Boolean |
getPerUserDefaultReadOnly(String username)
ユーザ毎の読み込み専用アクセスのデフォルトの設定値(defaultReadOnly)を取得します。
|
Integer |
getPerUserMaxActive(String username)
ユーザ毎のこのプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
|
Integer |
getPerUserMaxIdle(String username)
ユーザ毎の余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
|
Integer |
getPerUserMaxWait(String username)
ユーザ毎の利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
|
Reference |
getReference()
JNDI 内にバインディングするためにオブジェクトを準備する
Referenceable の実装です。
|
boolean |
getTestOnBorrow()
この値が true の場合、 ObjectPool.borrowObject()
にてプールからオブジェクトが取り出される前にチェックが行われます。
|
boolean |
getTestOnReturn()
この値が true の場合、 ObjectPool.returnObject(java.lang.Object)
にてプールへオブジェクトが返された後にチェックが行われます。
|
boolean |
getTestWhileIdle()
この値が true の場合、アイドル状態のオブジェクトを排除するスレッドにて
チェックが行われます。
|
int |
getTimeBetweenEvictionRunsMillis()
アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を返します。
|
String |
getValidationQuery()
このプールにコネクションが返された後にコネクションのチェックに使用される SQL クエリです。
|
boolean |
isDefaultAutoCommit()
このプールから取り出されるコネクションの状態を定義する defaultAutoCommit の値を取得します。
|
boolean |
isDefaultReadOnly()
このプールから取り出されるコネクションの状態を定義する defaultReadOnly の値を取得します。
|
void |
setConnectionPoolDataSource(ConnectionPoolDataSource v)
バックエンドの ConnectionPoolDataSource を設定します。
|
void |
setDataSourceName(String v)
このプールの内部の ConnectionPoolDataSource の名前を設定します。
|
void |
setDefaultAutoCommit(boolean v)
このプールから取り出されるコネクションの状態を定義する defaultAutoCommit の値を設定します。
|
void |
setDefaultMaxActive(int maxActive)
このプールから1度に割り当てることのできるアクティブなコネクションの最大数です。
|
void |
setDefaultMaxIdle(int defaultMaxIdle)
このプール内で開放されずにアイドル状態でいられるアクティブなコネクションの最大数です。
|
void |
setDefaultMaxWait(int defaultMaxWait)
利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
|
void |
setDefaultReadOnly(boolean v)
このプールから取り出されるコネクションの状態を定義する defaultReadOnly の値を設定します。
|
void |
setDescription(String v)
記述情報(Description)の値を設定します。
|
void |
setJndiEnvironment(String key,
String value)
JNDI InitialContext のインスタンス化の際に使用される jndiEnvironment の値を設定します。
|
void |
setLoginTimeout(int v)
loginTimeout の値を設定します。
|
void |
setLogWriter(PrintWriter v)
logWriter の値を設定します。
|
void |
setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
アイドル状態のオブジェクトがプール内に居られる最短時間を設定します。
|
void |
setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするオブジェクトの数を設定します。
|
void |
setPerUserDefaultAutoCommit(String username,
Boolean value)
ユーザ毎のオートコミットのデフォルトの設定値を設定します。
|
void |
setPerUserDefaultReadOnly(String username,
Boolean value)
ユーザ毎の読み込み専用アクセスのデフォルトの設定値(defaultReadOnly)を設定します。
|
void |
setPerUserMaxActive(String username,
Integer value)
ユーザ毎のこのプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
|
void |
setPerUserMaxIdle(String username,
Integer value)
ユーザ毎の余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
|
void |
setPerUserMaxWait(String username,
Integer value)
ユーザ毎の利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
|
void |
setTestOnBorrow(boolean testOnBorrow)
この値が true の場合、 ObjectPool.borrowObject()
にてプールからオブジェクトが取り出される前にチェックが行われます。
|
void |
setTestOnReturn(boolean testOnReturn)
この値が true の場合、 ObjectPool.returnObject(java.lang.Object)
にてプールへオブジェクトが返された後にチェックが行われます。
|
void |
setTestWhileIdle(boolean testWhileIdle)
この値が true の場合、アイドル状態のオブジェクトを排除するスレッドにて
チェックが行われます。
|
void |
setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を設定します。
|
void |
setValidationQuery(String validationQuery)
このプールにコネクションが返された後にコネクションのチェックに使用される SQL クエリです。
|
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Jdbc2PoolDataSource
public Jdbc2PoolDataSource()
- Serialization のための引数のないデフォルトコンストラクタ。
Default no-arg constructor for Serialization
getConnection
public Connection getConnection()
throws SQLException
- データベースとの接続の確立を試みます。
Attempt to establish a database connection.
- 定義:
- インタフェース
DataSource 内の getConnection
- 例外:
SQLException
getConnection
public Connection getConnection(String username,
String password)
throws SQLException
- データベースとの接続の確立を試みます。
Attempt to establish a database connection.
- 定義:
- インタフェース
DataSource 内の getConnection
- 例外:
SQLException
getConnectionPoolDataSource
public ConnectionPoolDataSource getConnectionPoolDataSource()
- connectionPoolDataSource の値を取得します。
内部のデータソースが JNDI を介してアクセスされている場合には null を返します。
Get the value of connectionPoolDataSource. This method will return
null, if the backing datasource is being accessed via jndi.
- 戻り値:
- connectionPoolDataSource の値
value of connectionPoolDataSource.
getDataSourceName
public String getDataSourceName()
- このプールの内部の ConnectionPoolDataSource の名前を取得します。
この名前は JNDI サービスプロバイダからデータソースをルックアップする際に使用されます。
Get the name of the ConnectionPoolDataSource which backs this pool.
This name is used to look up the datasource from a jndi service
provider.
- 戻り値:
- dataSourceName の値
value of dataSourceName.
getDefaultMaxActive
public int getDefaultMaxActive()
- このプールから1度に割り当てることのできるアクティブなコネクションの最大数です。
0が設定された場合には制限を行いません。
この値は perUserMaxConnections が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は0です。
The maximum number of active connections that can be allocated from
this pool at the same time, or zero for no limit.
This value is used for any username which is not specified
in perUserMaxConnections. The default is 0.
getDefaultMaxIdle
public int getDefaultMaxIdle()
- このプール内で開放されずにアイドル状態でいられるアクティブなコネクションの最大数です。
0が設定された場合には制限を行いません。
この値は perUserMaxIdle が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は0です。
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or zero for no limit.
This value is used for any username which is not specified
in perUserMaxIdle. The default is 0.
getDefaultMaxWait
public int getDefaultMaxWait()
- 利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
-1が設定された場合には期限を持たず待機します。
利用可能なコネクションがない場合に直ちに失敗としたい場合には0を設定します。
この値は perUserMaxWait が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は-1です。
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
This value is used for any username which is not specified
in perUserMaxWait. The default is -1.
getDescription
public String getDescription()
- 記述情報(Description)の値を取得します。
このプロパティはデータソースをデプロイする GUI 等のツールで使用するために JDBC にて定義されています。
このプロパティは内部の処理には何の影響も与えません。
Get the description. This property is defined by jdbc as for use with
GUI (or other) tools that might deploy the datasource. It serves no
internal purpose.
- 戻り値:
- 記述情報(Description)の値
value of description.
getJndiEnvironment
public String getJndiEnvironment(String key)
- JNDI InitialContext のインスタンス化の際に使用される jndiEnvironment の値を取得します。
この InitialContext はバックエンドの ConnectionPoolDataSource の場所を確認するために使用されます。
Get the value of jndiEnvironment which is used when instantiating
a jndi InitialContext. This InitialContext is used to locate the
backend ConnectionPoolDataSource.
- 戻り値:
- jndiEnvironment の値
value of jndiEnvironment.
getLoginTimeout
public int getLoginTimeout()
- loginTimeout の値を取得します。
Get the value of loginTimeout.
- 定義:
- インタフェース
DataSource 内の getLoginTimeout
- 戻り値:
- loginTimeout の値
value of loginTimeout.
getLogWriter
public PrintWriter getLogWriter()
- logWriter の値を取得します。
Get the value of logWriter.
- 定義:
- インタフェース
DataSource 内の getLogWriter
- 戻り値:
- logWriter の値
value of logWriter.
getMinEvictableIdleTimeMillis
public int getMinEvictableIdleTimeMillis()
- アイドル状態のオブジェクトがプール内に居られる最短時間を返します。
この時間を過ぎるとアイドル状態のオブジェクトを排除するスレッドのチェック対象となります。
Returns the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any).
- 関連項目:
setMinEvictableIdleTimeMillis(int),
setTimeBetweenEvictionRunsMillis(int)
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()
- アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするオブジェクトの数を返します。
Returns the number of objects to examine during each run of the
idle object evictor thread (if any).
- 関連項目:
setNumTestsPerEvictionRun(int),
setTimeBetweenEvictionRunsMillis(int)
getObjectInstance
public Object getObjectInstance(Object refObj,
Name name,
Context context,
Hashtable env)
throws Exception
- このクラスのインスタンスを生成するための ObjectFactory の実装です。
implements ObjectFactory to create an instance of this class
- 定義:
- インタフェース
ObjectFactory 内の getObjectInstance
- 例外:
Exception
getPerUserDefaultAutoCommit
public Boolean getPerUserDefaultAutoCommit(String key)
- ユーザ毎のオートコミットのデフォルトの設定値を取得します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultAutoCommit.
getPerUserDefaultReadOnly
public Boolean getPerUserDefaultReadOnly(String username)
- ユーザ毎の読み込み専用アクセスのデフォルトの設定値(defaultReadOnly)を取得します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultReadOnly.
getPerUserMaxActive
public Integer getPerUserMaxActive(String username)
- ユーザ毎のこのプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
0が設定された場合には制限を行いません。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of active connections that can be allocated from
this pool at the same time, or zero for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxActive.
getPerUserMaxIdle
public Integer getPerUserMaxIdle(String username)
- ユーザ毎の余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
0が設定された場合には制限を行いません。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or zero for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxIdle.
getPerUserMaxWait
public Integer getPerUserMaxWait(String username)
- ユーザ毎の利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
-1が設定された場合には期限を持たず待機します。
利用可能なコネクションがない場合に直ちに失敗としたい場合には0を設定します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxWait.
getReference
public Reference getReference()
throws NamingException
- JNDI 内にバインディングするためにオブジェクトを準備する
Referenceable の実装です。
Referenceable implementation prepares object for
binding in jndi.
- 定義:
- インタフェース
Referenceable 内の getReference
- 例外:
NamingException
getTestOnBorrow
public boolean getTestOnBorrow()
- この値が true の場合、
ObjectPool.borrowObject()
にてプールからオブジェクトが取り出される前にチェックが行われます。
チェックの結果、オブジェクトの状態が不適切と判断された場合このオブジェクトはプールから削除され、
他のオブジェクトを取り出すことを試みます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
before being returned by the {@link #borrowObject}
method. If the object fails to validate,
it will be dropped from the pool, and we will attempt
to borrow another.
- 関連項目:
setTestOnBorrow(boolean)
getTestOnReturn
public boolean getTestOnReturn()
- この値が true の場合、
ObjectPool.returnObject(java.lang.Object)
にてプールへオブジェクトが返された後にチェックが行われます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
before being returned to the pool within the
{@link #returnObject}.
- 関連項目:
setTestOnReturn(boolean)
getTestWhileIdle
public boolean getTestWhileIdle()
- この値が true の場合、アイドル状態のオブジェクトを排除するスレッドにて
チェックが行われます。
チェックの結果、オブジェクトの状態が不適切と判断された場合にはプールから削除されます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
by the idle object evictor (if any). If an object
fails to validate, it will be dropped from the pool.
- 関連項目:
setTestWhileIdle(boolean),
setTimeBetweenEvictionRunsMillis(int)
getTimeBetweenEvictionRunsMillis
public int getTimeBetweenEvictionRunsMillis()
- アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を返します。
マイナスの値が設定されている場合、アイドル状態のオブジェクトを排除するスレッドは動作しません。
Returns the number of milliseconds to sleep between runs of the
idle object evictor thread.
When non-positive, no idle object evictor thread will be
run.
- 関連項目:
setTimeBetweenEvictionRunsMillis(int)
getValidationQuery
public String getValidationQuery()
- このプールにコネクションが返された後にコネクションのチェックに使用される SQL クエリです。
指定する場合にはこのクエリは少なくとも1つの列を返す SQL SELECT ステートメントでなくてはなりません。
The SQL query that will be used to validate connections from this pool
before returning them to the caller. If specified, this query
MUST be an SQL SELECT statement that returns at least
one row.
isDefaultAutoCommit
public boolean isDefaultAutoCommit()
- このプールから取り出されるコネクションの状態を定義する defaultAutoCommit の値を取得します。
この設定は Connection の Connection.setAutoCommit(boolean) を使用して変更することができます。
デフォルトの値は true です。
Get the value of defaultAutoCommit, which defines the state of
connections handed out from this pool. The value can be changed
on the Connection using Connection.setAutoCommit(boolean).
The default is true.
- 戻り値:
- defaultAutoCommit の値
value of defaultAutoCommit.
isDefaultReadOnly
public boolean isDefaultReadOnly()
- このプールから取り出されるコネクションの状態を定義する defaultReadOnly の値を取得します。
この設定は Connection の Connection.setReadOnly(boolean) を使用して変更することができます。
デフォルトの値は false です。
Get the value of defaultReadOnly, which defines the state of
connections handed out from this pool. The value can be changed
on the Connection using Connection.setReadOnly(boolean).
The default is false.
- 戻り値:
- defaultReadOnly の値
value of defaultReadOnly.
setConnectionPoolDataSource
public void setConnectionPoolDataSource(ConnectionPoolDataSource v)
- バックエンドの ConnectionPoolDataSource を設定します。
データソースのアクセスに JNDI を使用する場合には、このプロパティは設定するべきではありません。
Set the backend ConnectionPoolDataSource. This property should not be
set if using jndi to access the datasource.
- パラメータ:
v - connectionPoolDataSource に割り当てる値
Value to assign to connectionPoolDataSource.
setDataSourceName
public void setDataSourceName(String v)
- このプールの内部の ConnectionPoolDataSource の名前を設定します。
この名前は JNDI サービスプロバイダからデータソースをルックアップする際に使用されます。
Set the name of the ConnectionPoolDataSource which backs this pool.
This name is used to look up the datasource from a jndi service
provider.
- パラメータ:
v - dataSourceName に割り当てる値
Value to assign to dataSourceName.
setDefaultAutoCommit
public void setDefaultAutoCommit(boolean v)
- このプールから取り出されるコネクションの状態を定義する defaultAutoCommit の値を設定します。
この設定は Connection の Connection.setAutoCommit(boolean) を使用して変更することができます。
デフォルトの値は true です。
Set the value of defaultAutoCommit, which defines the state of
connections handed out from this pool. The value can be changed
on the Connection using Connection.setAutoCommit(boolean).
The default is true.
- パラメータ:
v - defaultAutoCommit に割り当てる値
Value to assign to defaultAutoCommit.
setDefaultMaxActive
public void setDefaultMaxActive(int maxActive)
- このプールから1度に割り当てることのできるアクティブなコネクションの最大数です。
0が設定された場合には制限を行いません。
この値は perUserMaxConnections が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は0です。
The maximum number of active connections that can be allocated from
this pool at the same time, or zero for no limit.
This value is used for any username which is not specified
in perUserMaxConnections. The default is 0.
setDefaultMaxIdle
public void setDefaultMaxIdle(int defaultMaxIdle)
- このプール内で開放されずにアイドル状態でいられるアクティブなコネクションの最大数です。
0が設定された場合には制限を行いません。
この値は perUserMaxIdle が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は0です。
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or zero for no limit.
This value is used for any username which is not specified
in perUserMaxIdle. The default is 0.
setDefaultMaxWait
public void setDefaultMaxWait(int defaultMaxWait)
- 利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
-1が設定された場合には期限を持たず待機します。
利用可能なコネクションがない場合に直ちに失敗としたい場合には0を設定します。
この値は perUserMaxWait が指定されていない全てのユーザ名に対して適用されます。
デフォルトの値は-1です。
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
This value is used for any username which is not specified
in perUserMaxWait. The default is -1.
setDefaultReadOnly
public void setDefaultReadOnly(boolean v)
- このプールから取り出されるコネクションの状態を定義する defaultReadOnly の値を設定します。
この設定は Connection の Connection.setReadOnly(boolean) を使用して変更することができます。
デフォルトの値は false です。
Set the value of defaultReadOnly, which defines the state of
connections handed out from this pool. The value can be changed
on the Connection using Connection.setReadOnly(boolean).
The default is false.
- パラメータ:
v - defaultReadOnly に割り当てる値
Value to assign to defaultReadOnly.
setDescription
public void setDescription(String v)
- 記述情報(Description)の値を設定します。
このプロパティはデータソースをデプロイする GUI 等のツールで使用するために JDBC にて定義されています。
このプロパティは内部の処理には何の影響も与えません。
Set the description. This property is defined by jdbc as for use with
GUI (or other) tools that might deploy the datasource. It serves no
internal purpose.
- パラメータ:
v - 記述情報(Description)に割り当てる値
Value to assign to description.
setJndiEnvironment
public void setJndiEnvironment(String key,
String value)
- JNDI InitialContext のインスタンス化の際に使用される jndiEnvironment の値を設定します。
この InitialContext はバックエンドの ConnectionPoolDataSource の場所を確認するために使用されます。
Set the value of jndiEnvironment which is used when instantiating
a jndi InitialContext. This InitialContext is used to locate the
backend ConnectionPoolDataSource.
- パラメータ:
value - jndiEnvironment に割り当てる値
Value to assign to jndiEnvironment.
setLoginTimeout
public void setLoginTimeout(int v)
- loginTimeout の値を設定します。
Set the value of loginTimeout.
- 定義:
- インタフェース
DataSource 内の setLoginTimeout
- パラメータ:
v - loginTimeout に割り当てる値
Value to assign to loginTimeout.
setLogWriter
public void setLogWriter(PrintWriter v)
- logWriter の値を設定します。
Set the value of logWriter.
- 定義:
- インタフェース
DataSource 内の setLogWriter
- パラメータ:
v - logWriter に割り当てる値
Value to assign to logWriter.
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
- アイドル状態のオブジェクトがプール内に居られる最短時間を設定します。
この時間を過ぎるとアイドル状態のオブジェクトを排除するスレッドのチェック対象となります。
マイナスの値が設定された場合、アイドル状態で居た時間ではオブジェクトはプールから排除されません。
Sets the minimum amount of time an object may sit idle in the pool
before it is eligable for eviction by the idle object evictor
(if any).
When non-positive, no objects will be evicted from the pool
due to idle time alone.
- 関連項目:
getMinEvictableIdleTimeMillis(),
setTimeBetweenEvictionRunsMillis(int)
setNumTestsPerEvictionRun
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
- アイドル状態のオブジェクトを排除するスレッドが1度の動作でチェックの対象とするオブジェクトの数を設定します。
Sets the number of objects to examine during each run of the
idle object evictor thread (if any).
マイナスの値が設定された場合、ceil({*link #numIdle})/abs({*link #getNumTestsPerEvictionRun}) の数のテストが実施されます。
例えば値が -n の場合にはアイドル状態のステートメントのうち 1/n が1度の動作でテストされます。
When a negative value is supplied, ceil({@link #numIdle})/abs({@link #getNumTestsPerEvictionRun})
tests will be run. I.e., when the value is -n, roughly one nth of the
idle objects will be tested per run.
- 関連項目:
getNumTestsPerEvictionRun(),
setTimeBetweenEvictionRunsMillis(int)
setPerUserDefaultAutoCommit
public void setPerUserDefaultAutoCommit(String username,
Boolean value)
- ユーザ毎のオートコミットのデフォルトの設定値を設定します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultAutoCommit.
setPerUserDefaultReadOnly
public void setPerUserDefaultReadOnly(String username,
Boolean value)
- ユーザ毎の読み込み専用アクセスのデフォルトの設定値(defaultReadOnly)を設定します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The keys are usernames and the value is the --. Any
username specified here will override the value of defaultReadOnly.
setPerUserMaxActive
public void setPerUserMaxActive(String username,
Integer value)
- ユーザ毎のこのプールから1度に割り当てることのできるアクティブなステートメントの最大数です。
0が設定された場合には制限を行いません。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of active connections that can be allocated from
this pool at the same time, or zero for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxActive.
setPerUserMaxIdle
public void setPerUserMaxIdle(String username,
Integer value)
- ユーザ毎の余分なものを開放せずにプール内にアイドル状態で保持できるステートメントの最大数です。
0が設定された場合には制限を行いません。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of active connections that can remain idle in the
pool, without extra ones being released, or zero for no limit.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxIdle.
setPerUserMaxWait
public void setPerUserMaxWait(String username,
Integer value)
- ユーザ毎の利用可能なコネクションがない場合に例外を投げるまでプールが待機するミリセカンドの最大値です。
-1が設定された場合には期限を持たず待機します。
利用可能なコネクションがない場合に直ちに失敗としたい場合には0を設定します。
[訳者コメント:
コメントが不適切と思われるので書き換えました。 ]
The maximum number of milliseconds that the pool will wait (when there
are no available connections) for a connection to be returned before
throwing an exception, or -1 to wait indefinitely. Will fail
immediately if value is 0.
The keys are usernames and the value is the maximum connections. Any
username specified here will override the value of defaultMaxWait.
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow)
- この値が true の場合、
ObjectPool.borrowObject()
にてプールからオブジェクトが取り出される前にチェックが行われます。
チェックの結果、オブジェクトの状態が不適切と判断された場合このオブジェクトはプールから削除され、
他のオブジェクトを取り出すことを試みます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
before being returned by the {@link #borrowObject}
method. If the object fails to validate,
it will be dropped from the pool, and we will attempt
to borrow another.
- 関連項目:
getTestOnBorrow()
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn)
- この値が true の場合、
ObjectPool.returnObject(java.lang.Object)
にてプールへオブジェクトが返された後にチェックが行われます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
before being returned to the pool within the
{@link #returnObject}.
- 関連項目:
getTestOnReturn()
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle)
- この値が true の場合、アイドル状態のオブジェクトを排除するスレッドにて
チェックが行われます。
チェックの結果、オブジェクトの状態が不適切と判断された場合にはプールから削除されます。
When true, objects will be
{@link PoolableObjectFactory#validateObject validated}
by the idle object evictor (if any). If an object
fails to validate, it will be dropped from the pool.
- 関連項目:
getTestWhileIdle(),
setTimeBetweenEvictionRunsMillis(int)
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
- アイドル状態のオブジェクトを排除するスレッドが次の動作までスリープする時間を示すミリセカンドの値を設定します。
マイナスの値が設定されている場合、アイドル状態のオブジェクトを排除するスレッドは動作しません。
Sets the number of milliseconds to sleep between runs of the
idle object evictor thread.
When non-positive, no idle object evictor thread will be
run.
- 関連項目:
getTimeBetweenEvictionRunsMillis()
setValidationQuery
public void setValidationQuery(String validationQuery)
- このプールにコネクションが返された後にコネクションのチェックに使用される SQL クエリです。
指定する場合にはこのクエリは少なくとも1つの列を返す SQL SELECT ステートメントでなくてはなりません。
デフォルトの動作では、プールからコネクションが引き出される際にコネクションに対するテストが実施されます。
The SQL query that will be used to validate connections from this pool
before returning them to the caller. If specified, this query
MUST be an SQL SELECT statement that returns at least
one row. Default behavior is to test the connection when it is
borrowed.
このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation