AR System Java API

com.bmc.arsys.api
Class ProxyManager

java.lang.Object
  extended by com.bmc.arsys.apitransport.connection.ApiProxyManager
      extended by com.bmc.arsys.api.ProxyManager
All Implemented Interfaces:
com.bmc.arsys.apitransport.connection.ApiProxyManagerI

public abstract class ProxyManager
extends com.bmc.arsys.apitransport.connection.ApiProxyManager

ProxyManager is a factory class that provides clients with Proxy instances. It is an abstract class that provides the interface used by clients. It is implemented by two concrete subclasses, DefaultProxyManager and PoolingProxyManager. Neither subclass has a public constructor (they are package-scoped), so clients cannot access their services directly. For that, they must call the public static method getProxyManager of ProxyManager.

Proxies represent connections to AR System servers and provide access to their server via the native AR System API. Proxies are optionally pooled by a server. A client calling the server does not know whether proxies are being pooled or not, so it must release its connection when done and not hold on to a reference to it. If proxies are being pooled, this will return the proxy to the pool without terminating its connection. Otherwise, returning it will automatically terminate its connection and make the proxy available for garbage collection.

By default, the ProxyManager returned by getProxyManager pools connections. Pooling can be stopped at any time by calling this method with the argument false. When pooling is stopped, all connections in the pool are terminated. To restart pooling, call setUseConnectionPooling with the argument true.


Nested Class Summary
static class ProxyManager.PoolInfo
           
 
Method Summary
static void adjustConnectionPoolVariables(ProxyManager.PoolInfo poolsetting)
          Dynamically adjusts proxy connection pool sizes for each server when connection pooling is used.
 com.bmc.arsys.apitransport.ApiProxyI createProxy(com.bmc.arsys.apitransport.ApiUserContextI context)
          Internal use only
static com.bmc.arsys.apitransport.session.ARServerContext getARServerContext(String serverName, int port)
           
static long getConnectionLifespan(ARTimeUnit toUnit)
          get current connectionLifespan into given ARTimeUnit
static ProxyManager.PoolInfo[] getPoolInformation()
           
static com.bmc.arsys.apitransport.connection.ApiProxyManagerI getProxyManager()
          Internal use only Get the current ProxyManager instance.
static Map<String,com.bmc.arsys.apitransport.session.ARServerContext> getServerContextMap()
           
static boolean isUseConnectionPooling()
           
static void setConnectionLifespan(long newConnectionLifespan, ARTimeUnit unit)
          Set number of ARTimeUnit interval that
static void setConnectionLimits(int maxPerServer)
          Configure limits on proxy pool sizes per server when connection pooling is used before pool is established.
static void setUseConnectionPooling(boolean usePooling)
          Whether proxies are pooled or not is dynamically configurable.
 
Methods inherited from class com.bmc.arsys.apitransport.connection.ApiProxyManager
addCMTProxyInCMTPool, adjustProxyPoolVariables, checkCleanUpTimer, clear, deRecodeProxy, deRecodeProxy, deRegisterARServerUser, getConnectionLifespanMilliSec, getConnectionTimeoutMilliSec, getIdleConnectionsPerServer, getKeyForServer, getMaxConnectedServerCMTAllowed, getMaxProxiesPerServer, getProxy, getProxy, getProxy, getServerCmtTimeout, registerARServerUserCheck, releaseProxy, releaseProxy, releaseProxy, removeCMTProxyFromCMTPool, setMaxConnectedServerCMTAllowed, setServerCmtTimeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProxyManager

public static com.bmc.arsys.apitransport.connection.ApiProxyManagerI getProxyManager()
Internal use only Get the current ProxyManager instance.


setConnectionLimits

public static void setConnectionLimits(int maxPerServer)
Configure limits on proxy pool sizes per server when connection pooling is used before pool is established. The maxPerServer parameter decides the number of connections per server that the program can talk to. Calling this method overwrites the configured value. This method will not affect the pool which is already established. As of AR System 7.6, recommend use of #adjustConnectionVariables

Parameters:
maxPerServer - Maximum number of proxy connections per server

adjustConnectionPoolVariables

public static void adjustConnectionPoolVariables(ProxyManager.PoolInfo poolsetting)
Dynamically adjusts proxy connection pool sizes for each server when connection pooling is used. This method takes the following parameters:

Parameters:
poolsetting - requires the following values: maxProxyPerServer specifies the maximum number of proxy connections per server that the program can interact with. idleConnectionsPerServer specifies the number of idle connections per server that are not subject to the connectionTimeout limit. These connections can be idle indefinitely. connectionTimeout and ARTimeUnit specify the amount of time in ARTimeUnits that

-- connections that exceed idleConnectionsPerServer can be idle before being terminated. This timeout triggers active pools to clean up their excess idle connections.

-- If the value of idleConnectionsPerServer is set to 0, then the connection pool will be closed when all connections are closed.

This method overwrites the existing values of the variables. It can be called before or after a connection pool is established. The size of an existing connection pool is adjusted according to the new settings.

getConnectionLifespan

public static long getConnectionLifespan(ARTimeUnit toUnit)
get current connectionLifespan into given ARTimeUnit

Parameters:
toUnit; - if null, return in MILLISECONDS
Returns:

setConnectionLifespan

public static void setConnectionLifespan(long newConnectionLifespan,
                                         ARTimeUnit unit)
Set number of ARTimeUnit interval that

-- connection, with or without pool, will be load balanced since it established.

Parameters:
newConnectionLifespan - Number of ARTimeUnit interval
unit - ARTimeUnit

setUseConnectionPooling

public static void setUseConnectionPooling(boolean usePooling)
Whether proxies are pooled or not is dynamically configurable. This method enables switching between policies. When pooling is turned off, the underlying connection pool is cleared, terminating each connection. Thereafter, each use of a proxy in a call to the AR System server will result in a new connection being established and being terminated upon completion of the call. A proxy that was taken from a pool and released after the pool has been cleared will have its connection terminated.

Parameters:
usePooling - default value is true

isUseConnectionPooling

public static boolean isUseConnectionPooling()
Returns:
the useConnectionPooling

getPoolInformation

public static ProxyManager.PoolInfo[] getPoolInformation()

getServerContextMap

public static Map<String,com.bmc.arsys.apitransport.session.ARServerContext> getServerContextMap()
Returns:
the ARServerContext Map

getARServerContext

public static com.bmc.arsys.apitransport.session.ARServerContext getARServerContext(String serverName,
                                                                                    int port)

createProxy

public com.bmc.arsys.apitransport.ApiProxyI createProxy(com.bmc.arsys.apitransport.ApiUserContextI context)
                                                 throws ARException
Internal use only

Specified by:
createProxy in interface com.bmc.arsys.apitransport.connection.ApiProxyManagerI
Specified by:
createProxy in class com.bmc.arsys.apitransport.connection.ApiProxyManager
Throws:
ARException

AR System Java API

© Copyright 2006, 2007 BMC Software, Inc.