ws-wsif-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whitl...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers WSIFTransactionControl.java
Date Tue, 15 Apr 2003 10:00:30 GMT
whitlock    2003/04/15 03:00:30

  Modified:    java/src/org/apache/wsif/providers/jms Tag: pre1_2_0-patches
                        WSIFOperation_Jms.java
               java/src Tag: pre1_2_0-patches wsif.properties
  Added:       java/test Tag: pre1_2_0-patches wsif.properties
               java/test/transaction Tag: pre1_2_0-patches
                        WSIFTransactionControlDummyImpl.java
                        TransactionControlTest.java
               java/src/org/apache/wsif/providers Tag: pre1_2_0-patches
                        WSIFTransactionControl.java
  Log:
  19024: Enable suspend/resume transaction around JMS put
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +3 -0      xml-axis-wsif/java/test/Attic/wsif.properties
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.34.2.3  +47 -4     xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java
  
  Index: WSIFOperation_Jms.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java,v
  retrieving revision 1.34.2.2
  retrieving revision 1.34.2.3
  diff -u -r1.34.2.2 -r1.34.2.3
  --- WSIFOperation_Jms.java	18 Mar 2003 17:57:23 -0000	1.34.2.2
  +++ WSIFOperation_Jms.java	15 Apr 2003 10:00:28 -0000	1.34.2.3
  @@ -57,6 +57,8 @@
   
   package org.apache.wsif.providers.jms;
   
  +import java.security.AccessController;
  +import java.security.PrivilegedAction;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -89,6 +91,7 @@
   import org.apache.wsif.base.WSIFDefaultOperation;
   import org.apache.wsif.logging.MessageLogger;
   import org.apache.wsif.logging.Trc;
  +import org.apache.wsif.providers.WSIFTransactionControl;
   import org.apache.wsif.util.WSIFCorrelationServiceLocator;
   import org.apache.wsif.util.WSIFProperties;
   import org.apache.wsif.util.WSIFUtils;
  @@ -143,7 +146,8 @@
   
   	private long syncTimeout;
   	private long asyncTimeout;
  -
  +	transient private WSIFTransactionControl transControl;
  +	
   	/**
   	 * ctor
   	 */
  @@ -162,6 +166,35 @@
   		syncTimeout = WSIFProperties.getSyncTimeout();
   		asyncTimeout = WSIFProperties.getAsyncTimeout();
   
  +        final String name =
  +            WSIFProperties.getProperty("wsif.transactioncontrol.impl");
  +
  +        if (name != null) {
  +            Class clazz =  (Class) AccessController.doPrivileged(new PrivilegedAction()
{
  +                public Object run() {
  +                    try {
  +                        return Class.forName(
  +                            name,
  +                            true,
  +                            Thread.currentThread().getContextClassLoader());
  +                    } catch (Throwable ignored) {
  +                        Trc.ignoredException(ignored);
  +                    }
  +                    return null;
  +                }
  +            });
  +
  +            if (clazz != null) {
  +                try {
  +                    transControl = (WSIFTransactionControl) clazz.newInstance();
  +                } catch (Exception ignored) {
  +                    Trc.ignoredException(ignored);
  +                    transControl = null;
  +                }
  +            } else
  +                transControl = null;
  +        }
  +
   		if (Trc.ON)
   			Trc.exit(deep());
   	}
  @@ -203,13 +236,20 @@
   		setAsyncOperation(false);
   
   		boolean operationSucceeded = true;
  +		boolean txnSuspended = false;
   		try {
  -			getOperation();
  +            getOperation();
  +
  +            if (transControl != null) {
  +                transControl.suspend();
  +                txnSuspended = true;
  +            }
   
   			// send the jms message	  
   			String correlId = sendJmsMessage(input);
   
   			WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
  +			
   			javax.jms.Message response = jmsDest.receive(correlId, syncTimeout);
   			operationSucceeded = receiveJmsMessage(response, output, fault);
   
  @@ -228,7 +268,10 @@
   					+ fieldBindingOperation.getName()
   					+ "'",
   				ex);
  -		}
  +        } finally {
  +            if (txnSuspended)
  +                transControl.resume();
  +        }
   
   		Trc.exit(operationSucceeded);
   		return operationSucceeded;
  @@ -1099,7 +1142,7 @@
   
       	return bop;
       }
  -
  +    
   	public String deep() {
   		String buff = "";
   		try {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +94 -0     xml-axis-wsif/java/test/transaction/Attic/WSIFTransactionControlDummyImpl.java
  
  
  
  
  1.1.2.1   +140 -0    xml-axis-wsif/java/test/transaction/Attic/TransactionControlTest.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +5 -1      xml-axis-wsif/java/src/wsif.properties
  
  Index: wsif.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/wsif.properties,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- wsif.properties	19 Jul 2002 15:04:14 -0000	1.2
  +++ wsif.properties	15 Apr 2003 10:00:30 -0000	1.2.2.1
  @@ -25,4 +25,8 @@
   
   # maximum number of seconds to wait for a response to an async request. 
   # if not defined on invalid defaults to no timeout  
  -wsif.asyncrequest.timeout=60
  \ No newline at end of file
  +wsif.asyncrequest.timeout=60
  +
  +# The class name of an implementation of WSIFTransactionControl that will suspend
  +# and resume a global transaction around a JMS put (for instance).
  +#wsif.transactioncontrol.impl=""
  \ No newline at end of file
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +79 -0     xml-axis-wsif/java/src/org/apache/wsif/providers/Attic/WSIFTransactionControl.java
  
  
  
  

Mime
View raw message