|
SAP NetWeaver 2004S SPS 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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 for each pool independently.
| Nested Class Summary | |
protected static class |
JCO.PoolManager.TimeoutChecker
Helper class |
| Field Summary | |
protected long |
connection_timeout
The time (ms) after which a released pooled connection will be regarded as timed out |
protected long |
max_wait_time
The max. time to wait for a getClient() request |
protected Hashtable |
pools
Hashtable which holds the pools |
protected long |
timeout_check_period
The time interval (ms) after which the connections will be checked for timeouts periodically |
protected JCO.PoolManager.TimeoutChecker |
timeout_checker
The thread that checks for connections that have timed out |
| Constructor Summary | |
protected |
JCO.PoolManager()
Create a new instance of a PoolManager. |
| Method Summary | |
void |
addPool(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 |
void |
detachFromPool(JCO.Client client)
Detaches a client-connection from the pool. |
protected void |
firePoolChanged(JCO.Pool pool)
Calls the poolChanged() method of the registered listeners |
JCO.Client |
getClient(String pool_name)
Returns a new client connection from the specified pool. |
JCO.Client |
getClient(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 default value for the connection timeout in milliseconds. |
long |
getMaxWaitTime()
Returns the maximum time to wait in a connection request for a free connection. |
JCO.Pool |
getPool(String pool_name)
Returns the pool with the specified name or null if such a pool does not exist in the pool list |
String[] |
getPoolNames()
Returns the array of pool names that are currently under control of the manager |
long |
getTimeoutCheckPeriod()
Returns the default value for the timeout check period in milliseconds. |
protected static void |
registerPoolManager(JCO.PoolManager pool_manager)
Registers the given object as PoolManager |
void |
releaseClient(JCO.Client client)
Returns the client connection to the pool. |
void |
removeConnection(JCO.Connection connection)
Deprecated. This method will be removed in the next release. Use JCO.releaseClient(connection) instead |
void |
removePool(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 default value for the connection timeout in milliseconds. |
void |
setMaxWaitTime(long max_wait_time)
Sets the maximum time to wait in a connection request for a free connection. |
void |
setTimeoutCheckPeriod(long timeout_check_period)
Sets the default value for the timeout check period in milliseconds. |
static JCO.PoolManager |
singleton()
Returns the instance of the pool manager |
protected void |
startTimeoutChecker()
Starts TimeoutChecker for all pool managed by this pool manager The derived class may overwrite this method |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Hashtable pools
protected JCO.PoolManager.TimeoutChecker timeout_checker
protected long max_wait_time
protected long connection_timeout
protected long timeout_check_period
| Constructor Detail |
protected JCO.PoolManager()
startTimeoutChecker()| Method Detail |
protected void startTimeoutChecker()
public static JCO.PoolManager singleton()
protected static void registerPoolManager(JCO.PoolManager pool_manager)
JCO.Exception - with grouppublic void addPoolChangedListener(JCO.PoolChangedListener listener)
listener - the listener to addpublic void removePoolChangedListener(JCO.PoolChangedListener listener)
listener - the listener to removeprotected void firePoolChanged(JCO.Pool pool)
pool - the pool that has been modified
public void addPool(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 pool
JCO.Exception - thrown if a pool with the same name already exists.public String[] getPoolNames()
public JCO.Pool getPool(String pool_name)
pool_name - the name of the pool to returnpublic void removePool(String pool_name)
pool_name - the name of the pool to removepublic JCO.Client getClient(String pool_name)
Note: To avoid reconnect on connections to the SAP Systems below 4.0A it is necessary to set the resetOnRelease property to false and use JCO.getClient([pool name], false). Be careful, if you use this way, if have to be certain, that the application using this pool never invokes functions, that maintain a state on the ABAP server.
pool_name - the name of the pool from which to take the connection
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 exhausted
JCO.Exception - thrown if a client connection could not be established due to wrong logon data,
network problems, etc.JCO.releaseClient(com.sap.mw.jco.JCO.Client),
setMaxWaitTime(long)
public JCO.Client getClient(String pool_name,
boolean reset)
Note: To avoid reconnect on connections to the SAP Systems below 4.0A it is necessary to set the resetOnRelease property to false and use JCO.getClient([pool name], false). Be careful, if you use this way, if have to be certain, that the application using this pool never invokes functions, that maintain a state on the ABAP server.
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 exhausted
JCO.Exception - thrown if a client connection could not be established due to wrong logon data,
network problems, etc.JCO.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 pool
JCO.Exception - thrown if a connection could not be released cleanlygetClient(java.lang.String)public void detachFromPool(JCO.Client client)
client - the client connection which is being returned to its pool
JCO.Exception - thrown if a connection could not be removed from pool cleanlypublic void removeConnection(JCO.Connection connection)
JCO.releaseClient(connection) instead
connection - the connection which will be removed from its poolJCO.releaseClient(com.sap.mw.jco.JCO.Client),
releaseClient(com.sap.mw.jco.JCO.Client),
JCO.Pool.releaseClient(com.sap.mw.jco.JCO.Client)public long getTimeoutCheckPeriod()
JCO.Pool.getTimeoutCheckPeriod()public void setTimeoutCheckPeriod(long timeout_check_period)
timeout_check_period - the timeout check period in milliseconds.
IllegalArgumentException - if timeout_check_period is negative.JCO.Pool.setTimeoutCheckPeriod(long)public long getConnectionTimeout()
JCO.Pool.getConnectionTimeout()public void setConnectionTimeout(long connection_timeout)
connection_timeout - the new value for the connection timeout in millisecondsJCO.Pool.setConnectionTimeout(long),
getConnectionTimeout()public final long getMaxWaitTime()
JCO.Pool.getMaxWaitTime()public final void setMaxWaitTime(long max_wait_time)
max_wait_time - the maximum time to wait for a free connection
in millisecondsgetMaxWaitTime(),
JCO.Pool.setMaxWaitTime(long)
|
SAP NetWeaver 2004S SPS 10 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||