com.ibm.websphere.samples.jtaextensionssamples.transactiontrackerwar
Class TransactionTracker

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.ibm.websphere.samples.jtaextensionssamples.transactiontrackerwar.TransactionTracker
All Implemented Interfaces:
com.ibm.websphere.jtaextensions.SynchronizationCallback, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class TransactionTracker
extends javax.servlet.http.HttpServlet
implements com.ibm.websphere.jtaextensions.SynchronizationCallback

The TransactionTracker servlet provides a demonstration of WebSphere's Extended JTA Transaction functionality.

See Also:
Serialized Form

Constructor Summary
TransactionTracker()
           
 
Method Summary
 void afterCompletion(int localId, byte[] globalId, boolean committed)
          This method is invoked after the completion of a transaction.
 void beforeCompletion(int localId, byte[] globalId)
          This method is invoked before the completion of a transaction.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a get request to the TransactionTracker.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Act upon a post request to the TransactionTracker.
 void init()
          Initialize the TransactionTracker servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionTracker

public TransactionTracker()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initialize the TransactionTracker servlet. This method is driven when the servlet is first loaded and is used to register the synchronization callback with ExtendedJTATransaction and lookup UserTransaction.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Act upon a post request to the TransactionTracker. This method processes requests to run a new transaction that is either committed or rolledback. It outputs the result of the attempt to run the transaction as well as a table detailing all of the transactions that have undergone completion following the callback being registered at servlet initialization time.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Process a get request to the TransactionTracker. Output a form allowing the user to request that a transaction is run as well as a table of all callbacks that have been received since registration.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

beforeCompletion

public void beforeCompletion(int localId,
                             byte[] globalId)
This method is invoked before the completion of a transaction. For the purpose of this sample we simply store the details of the transaction involved in the Vector which is used to generate the table of completion calls.

Specified by:
beforeCompletion in interface com.ibm.websphere.jtaextensions.SynchronizationCallback

afterCompletion

public void afterCompletion(int localId,
                            byte[] globalId,
                            boolean committed)
This method is invoked after the completion of a transaction. For the purpose of this sample we simply store the details of the transaction involved in the Vector which is used to generate the table of completion calls.

Specified by:
afterCompletion in interface com.ibm.websphere.jtaextensions.SynchronizationCallback