com.softwareag.tamino.db.api.invocation
Interface TInvocationRetryHandler

All Known Implementing Classes:
TAbstractInvocationRetryHandler, TInvocationRetryOnConnectionTimeoutHandler, TInvocationRetryOnNoConnectionHandler

public interface TInvocationRetryHandler

The TInvocationRetryHandler interface defines operations needed to perform a user defined retry logic. Therefor the handler methods are called in certain points (join points) within the invocation process. At these points the handler is able to perform some specific retry functionality.
The invocation process is defined thru the abstract class TAbstractInvocation. All invocation calls (invoke(...)) enter here and they all end up in the method doTemplateInvoke(). This method now does some generic pre-/post-procesing (session state updating) before/after calling the protocol specific invocation, e.g. THTTPInvocation.doInvoke()
The handler "meets" the invocation at five join points: - prepare(): is called at the very first time within the invoke() where no pre/post-precessing has been done. This may be used for some kind of preparation/initialization of the handler. - retryAfterInvoke(): is called after the "real" invocation failed. - wrapUpAfterInvoke(): is called at the of the invoke(). This may be used to memorize state information for the next invocation of the handler. - retryAfterSessionModeUpdate(): is called after the session state has been tried to update and this failed. - wrapUpAfterSessionModeUpdate(): is called at the very end of the invoke(), i.e. after the session mode update has been done. This may be used to memorize state information for the next invocation of the handler. It is possible to define multiple handlers for a invocation. The first registered handler is triggered first. If he succeeds the following handlers will not be called. If he fails, the next handler gets a chance.

Version:
$Revision: 1.4 $
Author:
Stefan Liebig

Method Summary
 void prepare(TRetryInvocation invocation, TCommandStatement commandStatement, java.lang.String collection, java.lang.String doctype, java.lang.String docname, boolean useTransactionMode)
          Prepare an invocation.
 TInputStream retryAfterInvoke(TRetryInvocation invocation, TCommandStatement commandStatement, TInputStream inputStream, TInvocationException cause)
          Handle the "result" after the invocation has invoked the base communication (HTTP, ..) or tried to do that.
 TInputStream retryAfterSessionModeUpdate(TRetryInvocation invocation, TCommandStatement commandStatement, TInputStream inputStream, TTransactionModeUpdateException cause)
          Handle the "result" after the invocation has been updated or tried to update the session information from the command statement.
 void wrapUpAfterInvoke(TRetryInvocation invocation, TCommandStatement commandStatement)
          Wrap up an invocation after the invocation has invoked the base communication (HTTP, ..).
 void wrapUpAfterSessionModeUpdate(TRetryInvocation invocation, TCommandStatement commandStatement)
          Wrap up an session mode update.
 

Method Detail

prepare

void prepare(TRetryInvocation invocation,
             TCommandStatement commandStatement,
             java.lang.String collection,
             java.lang.String doctype,
             java.lang.String docname,
             boolean useTransactionMode)
Prepare an invocation. This method is called at the very beginning of the invocation where no processing has been done. Here some kind of preparation/initialization of the handler can be done.

Parameters:
invocation - spcifies the invocation.
commandStatement - specifies the concrete Tamino specific action that should be fullfilled. Session information is not yet set.
collection - is the collection of the Tamino DB to which the command statement might be related to.
doctype - within a schema of the given collection to which the command statement might be related to.
docname - is the name of the document to which the command statement might be related to.
useTransactionState - specifies whether the transaction state shall be considered.

retryAfterInvoke

TInputStream retryAfterInvoke(TRetryInvocation invocation,
                              TCommandStatement commandStatement,
                              TInputStream inputStream,
                              TInvocationException cause)
Handle the "result" after the invocation has invoked the base communication (HTTP, ..) or tried to do that.

Parameters:
invocation - spcifies the invocation.
commandStatement - specifies the concrete Tamino specific action that should be fullfilled. Session information is written to the command statement.
inputStream - the returned input stream from the base communiciation
cause - the exception caused by writing the session information or null, when it has been successfull.
Returns:
TInputStream with the successfull retry result or null otherwise.

wrapUpAfterInvoke

void wrapUpAfterInvoke(TRetryInvocation invocation,
                       TCommandStatement commandStatement)
Wrap up an invocation after the invocation has invoked the base communication (HTTP, ..). Here some memorization of state information can be done that can be used in the next invocation of the handler.

Parameters:
invocation - specifies the invocation.
commandStatement - specifies the Tamino command that was issued. Session information as returned by the previous Tamino command is set.

retryAfterSessionModeUpdate

TInputStream retryAfterSessionModeUpdate(TRetryInvocation invocation,
                                         TCommandStatement commandStatement,
                                         TInputStream inputStream,
                                         TTransactionModeUpdateException cause)
Handle the "result" after the invocation has been updated or tried to update the session information from the command statement.

Parameters:
invocation - spcifies the invocation.
commandStatement - specifies the concrete Tamino specific action that should be fullfilled. Session information is written to the command statement.
inputStream - the returned input stream from the base communiciation
cause - the exception caused by writing the session information or null, when it has been successfull.
Returns:
TInputStream with the successfull retry result or null otherwise.

wrapUpAfterSessionModeUpdate

void wrapUpAfterSessionModeUpdate(TRetryInvocation invocation,
                                  TCommandStatement commandStatement)
Wrap up an session mode update. This method is called at the very end of the invocation where all processing (i.e. seesion mode update) has been done. Here some memorization of state information can be done that can be used in the next invocation of the handler.

Parameters:
invocation - specifies the invocation.
commandStatement - specifies the Tamino command that was issued. Session information as returned by the previous Tamino command is set.


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