|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines the methods and properties for the connection pool. It allows for pooling connections to the server for optimal efficiency. A connection is the medium used to communicate with the MDM server.
The connection pool implementation maintains a minimum number of connections (see
setMinConnections(int) and ConnectionPoolFactory.setMinConnections(int)). In the
process of reserving a connection, if a connection is available, the connection is immediately returned. If a
connection is not available, a new connection is created if the maximum number of connections is not reached (see
setMaxConnections(int) and ConnectionPoolFactory.setMaxConnections(int)), otherwise
the request is blocked until a connection is available.
Connections are removed from the connection pool only under three conditions.
1. A connection goes bad.
2. The method freeUnused() is called.
3. The connection pool is garbage collected.
As for the connection pool, if it is created as shared, it exist for the lifetime of the JVM since it is referenced
by the ConnectionPoolFactory. If the connection pool is not shared, its existence is like any other Java
object. It is garbage collected when there is no reference to it.
The connection pool implementation also start up a background thread by default that checks the connections at a fix interval. A connection that is in a bad state, perhaps the MDM server was restarted, is removed.
All connection pools are associated with a connection source. A connection source is simply an identifier for grouping logically related connection pools. Connection source is mainly use for server notifications.
ConnectionPoolFactory,
SimpleConnectionFactory| Field Summary | |
static String |
DEFAULT_CLIENT_HOSTNAME
The default client host name. |
static String |
DEFAULT_CONNECTION_IDENTITY
The default connection identity. |
static String |
DEFAULT_HOSTNAME
The default host name. |
static int |
NO_TIMEOUT
A constants specifying no timeout. |
| Method Summary | |
void |
addConnectionPoolListener(ConnectionPoolListener listener)
Adds a listener for connection pool events. |
void |
freeUnused()
Frees any unused connections in the pool. |
int |
getAvailableCount()
Returns the current number of connections that are not in use. |
int |
getConnectionCount()
Returns the current number of connections that are open. |
String |
getConnectionSource()
Returns the connection source identifier. |
String |
getHostname()
Returns the host name where the MDM server is running. |
String |
getIdentity()
Returns the name/identifier of the connection. |
int |
getMaxConnections()
Returns the maximum number of connections. |
int |
getMinConnections()
Returns the minimum number of connections. |
int |
getPort()
Returns the port number used to communicate with the MDM server. |
int |
getReservedCount()
Returns the current number of connections that are in use. |
int |
getTimeout()
Returns the time out. |
boolean |
isNotificationEnabled()
Deprecated. |
boolean |
isReady()
Indicates whether the connection pool is ready for use. |
void |
removeConnectionPoolListener(ConnectionPoolListener listener)
Removes a listener from a connection pool. |
void |
setMaxConnections(int maxConnections)
Sets the maximum number of connections. |
void |
setMinConnections(int minConnections)
Sets the minimum number of connections. |
void |
setNotificationEnabled(boolean enabled)
Deprecated. this feature was never implemented |
void |
setTimeout(int milliseconds)
Sets the time out for the socket connection. |
void |
stopMonitoring()
Stops the background thread that monitors the connections in the connection pool. |
| Methods inherited from interface com.sap.mdm.net.ConnectionAccessor |
releaseConnection, reserveConnection, reserveConnection |
| Field Detail |
public static final int NO_TIMEOUT
public static final String DEFAULT_HOSTNAME
public static final String DEFAULT_CONNECTION_IDENTITY
public static final String DEFAULT_CLIENT_HOSTNAME
| Method Detail |
public void freeUnused()
public boolean isNotificationEnabled()
setNotificationEnabled(boolean)public void setNotificationEnabled(boolean enabled)
enabled - the notification statusEventDispatcherpublic int getTimeout()
setTimeout(int)public void setTimeout(int milliseconds)
milliseconds - the timeout in millisecondsgetTimeout()public String getHostname()
public String getConnectionSource()
public int getPort()
public String getIdentity()
public boolean isReady()
public int getMinConnections()
setMinConnections(int)public void setMinConnections(int minConnections)
minConnections - the minimum number of connectionsgetMinConnections()public int getMaxConnections()
setMaxConnections(int)public void setMaxConnections(int maxConnections)
maxConnections - the maximum number of connectionsgetMaxConnections()public int getConnectionCount()
getAvailableCount(),
getReservedCount()public int getAvailableCount()
freeUnused(),
getConnectionCount(),
getReservedCount()public int getReservedCount()
getAvailableCount(),
getConnectionCount()public void addConnectionPoolListener(ConnectionPoolListener listener)
listener - the listenerremoveConnectionPoolListener(ConnectionPoolListener)public void removeConnectionPoolListener(ConnectionPoolListener listener)
listener - the listeneraddConnectionPoolListener(ConnectionPoolListener)public void stopMonitoring()
Note: Special care should be taken if the connection pool is created as a shared connection pool.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Copyright 2004-2007 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.