com.softwareag.tamino.db.api.invocation
Class TPooledConnectionReconnectHandler

java.lang.Object
  extended by com.softwareag.tamino.db.api.invocation.TPooledConnectionReconnectHandler

public class TPooledConnectionReconnectHandler
extends java.lang.Object

The TPooledConnectionReconnectHandler is only active for connections which are pooled, or to be more precise for TConnection objects which are in local transaction mode and wrpped by TPooledConnection objects. For the invocation object of these TConnection objects a handler is instantiated which checks every first time a pooled connection is about to be reused. In that situation it is checked whether in the meantime the Tamino session might be timed out by Tamino. If that is the case, a reconnect is made by simply issuing a new _connect and replacing the session state parameters. The old session is simply forgotten.

Version:
$Revision: 1.5 $
Author:
Martin Meijsen

Constructor Summary
TPooledConnectionReconnectHandler(TDarkConnection connection)
          Construct a new TPooledConnectionReconnectHandler.
 
Method Summary
 int getFailedReconnects()
          Gets the number of failed reconnects
 int getReconnects()
          Gets the number of reconnects
 void prepare(TRetryInvocation invocation, TCommandStatement commandStatement, java.lang.String collection, java.lang.String doctype, java.lang.String docname, boolean useTransactionMode)
          Prepare a potential reconnect.
 void reconnect(TRetryInvocation invocation)
          Checks whether a reconnect is required and if so attempts to do so.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TPooledConnectionReconnectHandler

public TPooledConnectionReconnectHandler(TDarkConnection connection)
Construct a new TPooledConnectionReconnectHandler.

Parameters:
TPooledConnectionReconnectHandler - the T(Dark)Connection object for which this hanl�der is active.
Method Detail

prepare

public void prepare(TRetryInvocation invocation,
                    TCommandStatement commandStatement,
                    java.lang.String collection,
                    java.lang.String doctype,
                    java.lang.String docname,
                    boolean useTransactionMode)
Prepare a potential reconnect. This method is called everytime a request is passed to Tamino. It checks whether this is a _connect command and if so remembers the parameter setting of that _connect so it can be reissued.

Parameters:
invocation - spcifies the invocation.
commandStatement - specifies the concrete Tamino specific action that should be fulfilled. Session information is not yet set.
collection - is the collection of the Tamino DB associated to the command.
doctype - within a schema of the given collection associated to the command.
docname - is the name of the document associated to the command.
useTransactionState - specifies whether the transaction state shall be considered. Note that this implementation is identical to the logic followed by the TInvocationRetryOnConnectionTimeoutHandler. A different approach would also be possible: The _connect has to be parameterized exactly as the pool to which it belongs was parameterized by a TConnectionPoolDescriptor. This information could therefore alos be used to make the reconnect. This, however, requires that we have a way to find the pool in question.

reconnect

public void reconnect(TRetryInvocation invocation)
Checks whether a reconnect is required and if so attempts to do so.

Parameters:
invocation - specifies the invocation.

getReconnects

public int getReconnects()
Gets the number of reconnects

Returns:
the number of reconnects as an int

getFailedReconnects

public int getFailedReconnects()
Gets the number of failed reconnects

Returns:
the number of failed reconnects as an int


Copyright (c) 2013 Software AG. All Rights Reserved.