com.sap.mdm.net
Interface ConnectionPool

All Superinterfaces:
ConnectionAccessor

public interface ConnectionPool
extends ConnectionAccessor

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. 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, otherwise the request is blocked until a connection is available.

The connection pool implementation also start up a background thread that checks the connections at a fix internal. 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.

See Also:
ConnectionPoolFactory, SimpleConnectionFactory

Field Summary
static java.lang.String DEFAULT_CLIENT_HOSTNAME
          The default client host name.
static java.lang.String DEFAULT_CONNECTION_IDENTITY
          The default connection identity.
static java.lang.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.
 java.lang.String getConnectionSource()
          Returns the connection source identifier.
 java.lang.String getHostname()
          Returns the host name where the MDM server is running.
 java.lang.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.
 
Methods inherited from interface com.sap.mdm.net.ConnectionAccessor
releaseConnection, reserveConnection, reserveConnection
 

Field Detail

NO_TIMEOUT

public static final int NO_TIMEOUT
A constants specifying no timeout.

See Also:
Constant Field Values

DEFAULT_HOSTNAME

public static final java.lang.String DEFAULT_HOSTNAME
The default host name.

See Also:
Constant Field Values

DEFAULT_CONNECTION_IDENTITY

public static final java.lang.String DEFAULT_CONNECTION_IDENTITY
The default connection identity.

See Also:
Constant Field Values

DEFAULT_CLIENT_HOSTNAME

public static final java.lang.String DEFAULT_CLIENT_HOSTNAME
The default client host name.

See Also:
Constant Field Values
Method Detail

freeUnused

public void freeUnused()
Frees any unused connections in the pool.


isNotificationEnabled

public boolean isNotificationEnabled()
Deprecated.  

Indicates whether the connection pool should receive server notifications.

Returns:
notification status
See Also:
setNotificationEnabled(boolean)

setNotificationEnabled

public void setNotificationEnabled(boolean enabled)
Deprecated. this feature was never implemented

Sets the notification status, indicating whether the connection pool should receive server notifications

Parameters:
enabled - the notification status
See Also:
EventDispatcher

getTimeout

public int getTimeout()
Returns the time out.

Returns:
the time out.
See Also:
setTimeout(int)

setTimeout

public void setTimeout(int milliseconds)
Sets the time out for the socket connection. This is the time waiting on the socket connection for a response (SO_TIMEOUT).

Parameters:
milliseconds - the timeout in milliseconds
See Also:
getTimeout()

getHostname

public java.lang.String getHostname()
Returns the host name where the MDM server is running.

Returns:
the host name

getConnectionSource

public java.lang.String getConnectionSource()
Returns the connection source identifier. The connection source identifier groups a set of connections as logically related.

Returns:
the connection source identifier

getPort

public int getPort()
Returns the port number used to communicate with the MDM server.

Returns:
the port number

getIdentity

public java.lang.String getIdentity()
Returns the name/identifier of the connection.

Returns:
the connection identifier

isReady

public boolean isReady()
Indicates whether the connection pool is ready for use.

Returns:
the connection pool status

getMinConnections

public int getMinConnections()
Returns the minimum number of connections.

Returns:
the minimum number of connections
See Also:
setMinConnections(int)

setMinConnections

public void setMinConnections(int minConnections)
Sets the minimum number of connections. The connection pool will initially open this many connections.

Parameters:
minConnections - the minimum number of connections
See Also:
getMinConnections()

getMaxConnections

public int getMaxConnections()
Returns the maximum number of connections.

Returns:
the maximum number of connections
See Also:
setMaxConnections(int)

setMaxConnections

public void setMaxConnections(int maxConnections)
Sets the maximum number of connections. The connection pool will open at maximum this many connections

Parameters:
maxConnections - the maximum number of connections
See Also:
getMaxConnections()

getConnectionCount

public int getConnectionCount()
Returns the current number of connections that are open.

Returns:
the current number of connections
See Also:
getAvailableCount(), getReservedCount()

getAvailableCount

public int getAvailableCount()
Returns the current number of connections that are not in use.

Returns:
the number of connections that are not in use
See Also:
freeUnused(), getConnectionCount(), getReservedCount()

getReservedCount

public int getReservedCount()
Returns the current number of connections that are in use.

Returns:
the number of connections that are in use.
See Also:
getAvailableCount(), getConnectionCount()

addConnectionPoolListener

public void addConnectionPoolListener(ConnectionPoolListener listener)
Adds a listener for connection pool events. Events can include a connection create, a connection reserved, etc.

Parameters:
listener - the listener
See Also:
removeConnectionPoolListener(ConnectionPoolListener)

removeConnectionPoolListener

public void removeConnectionPoolListener(ConnectionPoolListener listener)
Removes a listener from a connection pool.

Parameters:
listener - the listener
See Also:
addConnectionPoolListener(ConnectionPoolListener)


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.