public class SessionManagerImpl extends java.lang.Object implements SessionManager
AusRegistry’s basic implementation of the SessionManager interface. Upon successful configuration, it
guarantees that a pool of Session
s will be available for processing
Transaction
s. A SessionManager is configured from a
SessionManagerProperties
object. This implementation provides only a
blocking implementation of the execute
method. It will create a
SessionPool
. By default, the
SessionPool
will use the
TLSSession
implementation of the
Session
interface. It also implements its own
StatsViewer
.
Uses the debug and user level loggers.
Modifier and Type | Method and Description |
---|---|
void |
changeMaxPoolSize(int size)
Change the maximum size that the managed session pool will grow to.
|
void |
changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
Change the EPP client password from oldPassword to newPassword.
|
void |
configure(SessionManagerProperties properties)
Configure the SessionManager from the given set of properties.
|
void |
execute(Transaction tx)
Try to process a single transaction.
|
int |
execute(Transaction[] txs)
Pipeline execute a sequence of commands over a single session.
|
Greeting |
getLastGreeting()
Get the service discovery information embodied in the most recent Greeting received from the EPP server.
|
SessionManagerProperties |
getProperties()
Returns the properties used during configuration.
|
StatsViewer |
getStatsViewer()
Get the StatsViewer responsible for providing operating statistics about the SessionManager.
|
void |
run()
Initiate the SessionPool's keep-alive system.
|
void |
shutdown()
Shutdown the SessionManager, making it unavailable for further transaction processing.
|
void |
startup()
Prepare the SessionManager for providing Transaction processing services.
|
public SessionManagerProperties getProperties()
SessionManager
getProperties
in interface SessionManager
public void configure(SessionManagerProperties properties) throws ConfigurationException
SessionPool
. A change of password should be performed using changePassword
. Following a change of password,
the properties source should be updated to reflect the change. If this is not done, then the next invocation of
configure will fail due to session login failures. A successful call to configure indicates that subsequent
invocations of execute may succeed
(dependent on the semantics of the command and the context). If the configuration fails and a previous invocation
of configure succeeded, then the previous configuration remains in effect, but the causal exception is thrown. If
the configuration fails and there was no previous valid configuration, then an exception is raised and the
SessionManager instance remains unusable (invocations of execute are guaranteed to fail, raising one of
FatalSessionException, IOException or InvalidStateException).configure
in interface SessionManager
properties
- the properties to be usedConfigurationException
- the configuration exceptionpublic Greeting getLastGreeting() throws SessionConfigurationException, SessionOpenException
getLastGreeting
in interface SessionManager
SessionConfigurationException
- No prior connection to the EPP server had been established and the SessionPoolProperties provided to
the SessionPool for the purpose of establishing a new Session were invalid.SessionOpenException
- No prior connection to the EPP server had been established and the attempt to establish a connection
for the purpose of retrieving service information failed.public void startup() throws SessionConfigurationException, SessionOpenException
SessionPool
managed by the SessionManager, guaranteeing that any
requirements defined by SessionPool properties are met, providing the pool is initialised successfully.startup
in interface SessionManager
SessionConfigurationException
- The pool was unable configure a session due to a configuration issue. Such problems include invalid
server location specification and missing or invalid authentication resources.SessionOpenException
- The pool was unable to open a session due to a configuration issue. Such problems include incorrect
server location, failed authentication and network failure.public void shutdown()
shutdown
in interface SessionManager
public void run()
run
in interface SessionManager
run
in interface java.lang.Runnable
public void changeMaxPoolSize(int size)
changeMaxPoolSize
in interface SessionManager
size
- the new size of the session poolpublic void changePassword(java.lang.String oldPassword, java.lang.String newPassword)
changePassword
in interface SessionManager
oldPassword
- the old passwordnewPassword
- the new passwordpublic void execute(Transaction tx) throws FatalSessionException, java.io.IOException, ParsingException, CommandFailedException, java.lang.IllegalStateException
MAX_ACCEPTABLE_FAIL_COUNT
attempts will be made to process the
transaction in cases where I/O errors or non-protocol server errors occur during processing. Use of the
underlying session is protected against concurrent use by other threads by using the getSession/releaseSession
features of this SessionManager's SessionPool
. This method guarantees
that the session used will be returned to the pool before the method returns.execute
in interface SessionManager
tx
- the Transaction to be executed.FatalSessionException
- No session could be acquired to process the transaction. Check the exception message and log records
for details.java.io.IOException
- Every attempt to execute the transaction command failed due to an IOException. This is the last such
IOException.ParsingException
- Parsing of the response failed. Check the exception message for the cause.CommandFailedException
- The acceptable limit on the number of failed commands due to server error was exceeded in trying to
process the command. This probably indicates a server limitation related to the command being
processed.java.lang.IllegalStateException
- The SessionManager had been shutdown or not started up prior to invoking this method.public int execute(Transaction[] txs) throws FatalSessionException, java.lang.IllegalStateException, java.io.IOException
Session
is used in order to guarantee ordering of command effects. Only
those transactions in the UNPROCESSED or RETRY states are executed. The number of transactions in the PROCESSED
state following attempted execution of all eligible transactions is returned. If the number returned is less than
the number of transactions supplied, then the state of each transaction should be checked prior to getting
information from the contained response object. If the state is PROCESSED, then it is safe to use any of the
methods on the response. If the state is RETRY, then it is possible that a further attempt to execute the
transaction will succeed. If the state is FATAL_ERROR, then the transaction should not be re-attempted. In either
of these cases, the getCause method can be used to determine the reason the transaction failed. If the state
remains UNPROCESSED, it indicates that an error which occurred in processing an earlier transaction would have
prevented the successful processing of the UNPROCESSED transaction. These transactions should be retried once the
underlying cause of the first error has been resolved.execute
in interface SessionManager
txs
- the Transactions to be sent to the EPP server.FatalSessionException
- No session was available to process any transactions (possibly due to misconfiguration or service
unavailability - check the exception message and log records). See the description in
SessionManager.execute(Transaction[])
for recommended
action.java.io.IOException
- An I/O error occurred while trying to send some command in the given Transaction array.java.lang.IllegalStateException
- The SessionManager had been shutdown or not started up prior to invoking this method. See
SessionManager.startup()
and
SessionManager.shutdown()
.public StatsViewer getStatsViewer()
getStatsViewer
in interface SessionManager