|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sap.mw.jco.JCO.PoolManager
This manager handles all pool objects. It checks periodically which connections are no longer in use and can be closed in order to save valuable system resources. The time period after which the pool manager checks the connections as well as the time after which a connection will time-out can be configured by the calling application.
Method Summary | |
void |
addPool(java.lang.String pool_name,
JCO.Client master,
int max_pool_size)
Adds a new pool to the pools list |
void |
addPoolChangedListener(JCO.PoolChangedListener listener)
Register a pool changed listener |
JCO.Client |
getClient(java.lang.String pool_name)
Returns a new client connection from the specified pool. Note: Any client obtained by this method must be released with JCO.releaseClient() if not needed anymore. |
JCO.Client |
getClient(java.lang.String pool_name,
boolean reset)
Returns a new client connection from the specified pool and resets all resources associated with this connection. |
long |
getConnectionTimeout()
Returns the connection timeout (in milliseconds). |
long |
getMaxWaitTime()
Returns the max. time to wait for a connection request when the pool is exhausted. The default value is 30 seconds (30000 ms). |
JCO.Pool |
getPool(java.lang.String pool_name)
Returns the pool with the specified name or null if such a pool does not exist in the pool list |
java.lang.String[] |
getPoolNames()
Returns the array of pool names that are currently under control of the manager |
long |
getTimeoutCheckPeriod()
Returns the timeout check period in (ms), i.e. the time after which all connections are being checked for timeouts periodically. The default value is 60 seconds (60000 ms). |
void |
releaseClient(JCO.Client client)
Returns the client connection to the pool. On SAP systems equal or above 4.0A the method resets the connection, i.e. frees all resources and context allocated on the server side (i.e. |
void |
removeConnection(JCO.Connection connection)
Closes a connection and removes it from the pool |
void |
removePool(java.lang.String pool_name)
Removes the named pool from the list of pools. |
void |
removePoolChangedListener(JCO.PoolChangedListener listener)
Unregister a pool changed listener |
void |
setConnectionTimeout(long connection_timeout)
Sets the new connection timeout (in milliseconds). |
void |
setMaxWaitTime(long max_wait_time)
Sets the max. time to wait in a connection request when a pool is exhausted. |
void |
setTimeoutCheckPeriod(long timeout_check_period)
Sets the timeout check period (in milliseconds), i.e. the time after which all connections are being checked for timeouts periodically. |
static JCO.PoolManager |
singleton()
Returns the instance of the pool manager |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static JCO.PoolManager singleton()
public void addPoolChangedListener(JCO.PoolChangedListener listener)
listener
- the listener to addpublic void removePoolChangedListener(JCO.PoolChangedListener listener)
listener
- the listener to removepublic long getTimeoutCheckPeriod()
public void setTimeoutCheckPeriod(long timeout_check_period)
timeout_check_period
- the new interval after which the connections will
be checked for timeouts.public long getConnectionTimeout()
public void setConnectionTimeout(long connection_timeout)
connection_timeout
- the new value for the connection timeout in millisecondspublic final long getMaxWaitTime()
public final void setMaxWaitTime(long max_wait_time)
max_wait_time
- the time to wait for a connection requestpublic void addPool(java.lang.String pool_name, JCO.Client master, int max_pool_size)
pool_name
- the name of the new poolmaster
- the connection that specifies the parameters for all
connections in this pool.max_pool_size
- the max. number of connections that can be opened
simultaneously in this poolJCO.Exception
- thrown if a pool with the same name already exists.public java.lang.String[] getPoolNames()
public JCO.Pool getPool(java.lang.String pool_name)
pool_name
- the name of the pool to returnpublic void removePool(java.lang.String pool_name)
pool_name
- the name of the pool to removepublic JCO.Client getClient(java.lang.String pool_name)
pool_name
- the name of the pool from which to take the connectionJCO.Exception
- with the error group set to JCO.Exception.JCO_ERROR_RESOURCE,
if a client could not be allocated, i.e. the client pool is exhaustedJCO.Exception
- thrown if a client connection could not be established due to wrong logon data,
network problems, etc.releaseClient(com.sap.mw.jco.JCO.Client)
,
setMaxWaitTime(long)
public JCO.Client getClient(java.lang.String pool_name, boolean reset)
pool_name
- the name of the pool from which to take the connectionreset
- if true reset the connection, e.g. free all resources
that might have been allocated on either the server side or by the local
middleware layer. On SAP systems below 4.0A resetting a connection
effectively means closing and subsequently reopening the connection
which is a very expensive process. However, several scenarios
(e.g. BAPIs) might need such reinitialized connections. Use with care !JCO.Exception
- with the error group set to JCO.Exception.JCO_ERROR_RESOURCE,
if a client could not be allocated, i.e. the client pool is exhaustedJCO.Exception
- thrown if a client connection could not be established due to wrong logon data,
network problems, etc.releaseClient(com.sap.mw.jco.JCO.Client)
,
setMaxWaitTime(long)
public void releaseClient(JCO.Client client)
client
- the client connection which is being returned to its poolJCO.Exception
- thrown if a connection could not be released cleanlygetClient(java.lang.String)
public void removeConnection(JCO.Connection connection)
connection
- the connection which will be removed from its pool
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |