Package com.verisign.epp.pool
Class EPPSystemSessionPool
- java.lang.Object
-
- com.verisign.epp.pool.EPPSystemSessionPool
-
public class EPPSystemSessionPool extends java.lang.ObjectEPP session pool for a specific system name that will handle creating sessions dynamically, expiring session after an absolute timeout, keeping sessions alive based on an idle timeout, and dynamically grows and shrinks the pool based on configurable settings. One of theinitmethods must be called before useing the pool. Theinit()method uses configuration settings defined in theEnvironmentclass. TheEnvironmentsettings include the following based on the system name defined by <system>:
EPP.SessionPool.<system>.poolableClassName- (required) EPPSessionPoolableFactory class used by the pool.EPP.SessionPool.<system>.clientId- (required) Login nameEPP.SessionPool.<system>.password- (required) passwordEPP.SessionPool.<system>.serverName- Name or IP address of TCP server or URL of HTTP serverEPP.SessionPool.<system>.serverPort- (optional) TCP server port number. This is not used for a HTTP server connectionEPP.SessionPool.<system>.absoluteTimeout- (optional) Session absolute timeout. Default is 24 hours.EPP.SessionPool.<system>.minAbsoluteTimeout- Session minimum absolute timeout. If bothminAbsoluteTimeoutandmaxAbsoluteTimeoutis set, it will overrideabsoluteTimeoutand randomize the session absolute timeout between theminAbsoluteTimeoutandmaxAbsoluteTimeout.EPP.SessionPool.<system>.maxAbsoluteTimeout- Session maximum absolute timeout. If bothminAbsoluteTimeoutandmaxAbsoluteTimeoutis set, it will overrideabsoluteTimeoutand randomize the session absolute timeout between theminAbsoluteTimeoutandmaxAbsoluteTimeout.EPP.SessionPool.<system>.idleTimeout- (optional) Session idle timeout used to determine when keep alive messages are sent. Default is 10 minutes.EPP.SessionPool.<system>.maxIdle- (optional) Maximum number of idle sessions in pool. Default is 10.EPP.SessionPool.<system>.initMaxTotal- (optional) Boolean value indicating if themaxTotalsessions should be pre-initialized at initialization in theinit()method. Default isfalse.EPP.SessionPool.<system>.maxTotal- (optional) Maximum number of active sessions in pool. Default is 10.EPP.SessionPool.<system>.maxWait- (optional) Maximum time in milliseconds for a client to block waiting for a pooled session. Default is 60 seconds.EPP.SessionPool.<system>.minIdle- (optional) Minimum number of idle sessions in the pool. Default is 0.EPP.SessionPool.<system>.timeBetweenEvictionRunsMillis- (optional) Frequency in milliseconds of scanning the pool for idle and absolute timeout sessions. Default is 60 seconds.EPP.SessionPool.<system>.borrowRetries- (optional) Number of retries to get/create a session when callingborrowObject(). Default is0.EPP.SessionPool.<system>.SSLProtocol- (optional) SSL protocol to use. If defined the pool will have its own SSL configuration. The required SSL properties includeSSLKeyStore,SSLKeyFileName, andSSLKeyPassPhraseEPP.SessionPool.<system>.SSLKeyStore- (optional) Type of identity KeyStore. Required ifSSLProtocolis defined for pool.EPP.SessionPool.<system>.SSLKeyFileName- (optional) Name of the identity KeyStore file. Required ifSSLProtocolis defined for pool.EPP.SessionPool.<system>.SSLPassPhrase- (optional) The passphrase/password to access the identity KeyStore file defined bySSLKeyFileName. Required ifSSLProtocolis defined for pool.EPP.SessionPool.<system>.SSLKeyPassPhrase- (optional) the passphrase/password for the private key stored in the identity KeyStore.EPP.SessionPool.<system>.SSLTrustStore- (optional) KeyStore type of the Trust StoreEPP.SessionPool.<system>.SSLTrustStoreFileName- (optional) The name of the Trust Store file. If not defined for the pool, the default JDK Trust Store will be used that is located at the path$JAVA_HOME/lib/security/cacerts.EPP.SessionPool.<system>.SSLTrustStorePassPhrase- (optional) The passphrase/password to access the Trust Store file defined by the poolSSLTrustStoreFileNameproperty.EPP.SessionPool.<system>.SSLEnabledProtocols- (optional) The space delimited list of enabled SSL protocols.EPP.SessionPool.<system>.SSLEnabledCipherSuites- (optional) The space delimited list of SSL cipher suites.EPP.SessionPool.<system>.SSLDebug- (optional) Defines the SSL debug Java system propertyjavax.net.debugvalue.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_ABSOLUTE_TIMEOUTThe default session absolute timeout.static longDEFAULT_IDLE_TIMEOUTThe default session absolute timeout.static intDEFAULT_MAX_IDLEThe default cap on the number of "sleeping" instances in the pool.static intDEFAULT_MAX_TOTALThe default cap on the total number of instances for the pool.static longDEFAULT_MAX_WAITThe default maximum amount of time (in millis) theborrowObject()method should block before throwing an exception.static intDEFAULT_MIN_IDLEThe default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects.static longDEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLISThe default "time between eviction runs" value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EPPSessionborrowObject()Borrows a session from the pool.voidclose()Closes the session pool contained inEPPSystemSessionPoolcleanly.longgetAbsoluteTimeout()Gets the session absolute timeout.java.lang.StringgetClientHost()Gets the TCP server IP address or host name to connect from.java.lang.StringgetClientId()Gets the client identifier used to authenticate.org.apache.commons.pool2.impl.GenericObjectPoolConfig<EPPPooledGenericSession>getConfig()Gets the configuration for theGenericObjectPool<EPPPooledGenericSession>.EPPSessionPoolableFactorygetFactory()Gets the factory associated with the pool.org.apache.commons.pool2.impl.GenericObjectPool<EPPPooledGenericSession>getGenericObjectPool()Gets the containedGenericObjectPool<EPPPooledGenericSession>.longgetIdleTimeout()Gets the session idle timeout.java.lang.StringgetPassword()Gets the password used for authentication.java.lang.StringgetServerName()Gets the TCP server IP address or host name, or the URL of the HTTP server.java.lang.IntegergetServerPort()Gets the TCP server port number.java.lang.StringgetSystem()Gets the system name associated with this pool.voidinit()Initialize the pool using configuration values defined byEnvironmentclass.voidinit(EPPSessionPoolableFactory aFactory, org.apache.commons.pool2.impl.GenericObjectPoolConfig<EPPPooledGenericSession> aConfig)Initialize the pool with a specificEPPSessionPoolableFactoryandGenericObjectPoolConfig<EPPPooledGenericSession>setting.voidinvalidateObject(EPPSession aSession)Remove a borrowed session from the pool based on a known issue with it.voidreturnObject(EPPSession aSession)Returned a borrowed session to the pool.voidsetClientHost(java.lang.String aClientHost)Sets the TCP server IP address or host name to connect from.voidsetServerName(java.lang.String aServerName)Sets the TCP server IP address or host name or the URL of the HTTP server.voidsetServerPort(java.lang.Integer aServerPort)Sets the TCP server port number.
-
-
-
Field Detail
-
DEFAULT_ABSOLUTE_TIMEOUT
public static final long DEFAULT_ABSOLUTE_TIMEOUT
The default session absolute timeout.- See Also:
- Constant Field Values
-
DEFAULT_IDLE_TIMEOUT
public static final long DEFAULT_IDLE_TIMEOUT
The default session absolute timeout.- See Also:
- Constant Field Values
-
DEFAULT_MAX_WAIT
public static final long DEFAULT_MAX_WAIT
The default maximum amount of time (in millis) theborrowObject()method should block before throwing an exception.- See Also:
- Constant Field Values
-
DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS
The default "time between eviction runs" value.- See Also:
- Constant Field Values
-
DEFAULT_MAX_IDLE
public static final int DEFAULT_MAX_IDLE
The default cap on the number of "sleeping" instances in the pool.- See Also:
- Constant Field Values
-
DEFAULT_MAX_TOTAL
public static final int DEFAULT_MAX_TOTAL
The default cap on the total number of instances for the pool.- See Also:
- Constant Field Values
-
DEFAULT_MIN_IDLE
public static final int DEFAULT_MIN_IDLE
The default minimum number of "sleeping" instances in the pool before before the evictor thread (if active) spawns new objects.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(EPPSessionPoolableFactory aFactory, org.apache.commons.pool2.impl.GenericObjectPoolConfig<EPPPooledGenericSession> aConfig)
Initialize the pool with a specificEPPSessionPoolableFactoryandGenericObjectPoolConfig<EPPPooledGenericSession>setting.- Parameters:
aFactory- EPP session poolable object factoryaConfig- Configuration attributes for pool
-
init
public void init() throws EPPSessionPoolExceptionInitialize the pool using configuration values defined byEnvironmentclass. TheEnvironmentclass and logging must be initialized before calling this method.- Throws:
EPPSessionPoolException- On error
-
close
public void close()
Closes the session pool contained inEPPSystemSessionPoolcleanly. Cleanly closing the pool means clearing the pool that will execute an EPP logout for each of the idle sessions and close the pool.
-
borrowObject
public EPPSession borrowObject() throws EPPSessionPoolException
Borrows a session from the pool. The session must be returned by either callinginvalidateObject(com.verisign.epp.interfaces.EPPSession)orreturnObject(com.verisign.epp.interfaces.EPPSession). This method will block if there are no idle sessions in the pool formaxWaittime.- Returns:
- Borrowed
EPPSessioninstance. - Throws:
EPPSessionPoolException- On error
-
invalidateObject
public void invalidateObject(EPPSession aSession) throws EPPSessionPoolException
Remove a borrowed session from the pool based on a known issue with it. The should be done if an unexpected exception occurs with the session which might be due to the server being down or the session being expired. ;- Parameters:
aSession- Session that is invalid- Throws:
EPPSessionPoolException- On error
-
returnObject
public void returnObject(EPPSession aSession) throws EPPSessionPoolException
Returned a borrowed session to the pool. This session must have been returned from a call toborrowObject().- Parameters:
aSession- Session to return- Throws:
EPPSessionPoolException- On error
-
getGenericObjectPool
public org.apache.commons.pool2.impl.GenericObjectPool<EPPPooledGenericSession> getGenericObjectPool()
Gets the containedGenericObjectPool<EPPPooledGenericSession>.- Returns:
- Contained
GenericObjectPool<EPPPooledGenericSession>
-
getAbsoluteTimeout
public long getAbsoluteTimeout()
Gets the session absolute timeout.- Returns:
- Returns the absolute timeout in milliseconds.
-
getClientId
public java.lang.String getClientId()
Gets the client identifier used to authenticate.- Returns:
- Returns the client identifier.
-
getConfig
public org.apache.commons.pool2.impl.GenericObjectPoolConfig<EPPPooledGenericSession> getConfig()
Gets the configuration for theGenericObjectPool<EPPPooledGenericSession>.- Returns:
- Returns the config.
-
getFactory
public EPPSessionPoolableFactory getFactory()
Gets the factory associated with the pool.- Returns:
- Returns the factory.
-
getIdleTimeout
public long getIdleTimeout()
Gets the session idle timeout.- Returns:
- Returns the idle timeout in milliseconds.
-
getPassword
public java.lang.String getPassword()
Gets the password used for authentication.- Returns:
- Returns the password.
-
getSystem
public java.lang.String getSystem()
Gets the system name associated with this pool.- Returns:
- Pool system name
-
getServerName
public java.lang.String getServerName()
Gets the TCP server IP address or host name, or the URL of the HTTP server.- Returns:
- Server host name, IP address, or URL
-
setServerName
public void setServerName(java.lang.String aServerName)
Sets the TCP server IP address or host name or the URL of the HTTP server.- Parameters:
aServerName- Server host name, IP address, or URL
-
getServerPort
public java.lang.Integer getServerPort()
Gets the TCP server port number. This will benullif connecting to a HTTP server.- Returns:
- TCP server port number if defined;
nullotherwise.
-
setServerPort
public void setServerPort(java.lang.Integer aServerPort)
Sets the TCP server port number.- Parameters:
aServerPort- TCP server port number
-
getClientHost
public java.lang.String getClientHost()
Gets the TCP server IP address or host name to connect from. Anullvalue will use the loop back.- Returns:
- Client host name or IP address if defined;
nullotherwise.
-
setClientHost
public void setClientHost(java.lang.String aClientHost)
Sets the TCP server IP address or host name to connect from. Anullvalue will use the loop back.- Parameters:
aClientHost- Client host name or IP address
-
-