ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatf...@apache.org
Subject svn commit: r577588 - in /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2: client/SandeshaClient.java msgprocessors/MakeConnectionProcessor.java storage/inmemory/InMemoryStorageManager.java util/SandeshaUtil.java
Date Thu, 20 Sep 2007 07:08:45 GMT
Author: gatfora
Date: Thu Sep 20 00:08:44 2007
New Revision: 577588

URL: http://svn.apache.org/viewvc?rev=577588&view=rev
Log:
Allow faster copy of messages stored in the InMemoryStorageManager

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java?rev=577588&r1=577587&r2=577588&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClient.java
Thu Sep 20 00:08:44 2007
@@ -684,6 +684,8 @@
 	 */
 	public static void waitUntilSequenceCompleted(ServiceClient serviceClient, long maxWaitingTime)
 			throws SandeshaException {
+		if (log.isDebugEnabled())
+			log.debug("Enter: SandeshaClient::waitUntilSequenceCompleted , " + maxWaitingTime);
 
 		long startTime = System.currentTimeMillis();
 
@@ -718,6 +720,8 @@
 				}
 			}
 		}
+		if (log.isDebugEnabled())
+			log.debug("Exit: SandeshaClient::waitUntilSequenceCompleted , " + maxWaitingTime);
 	}
 
 	public static void waitUntilSequenceCompleted(ServiceClient serviceClient, long maxWaitingTime,
String sequenceKey)

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java?rev=577588&r1=577587&r2=577588&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
Thu Sep 20 00:08:44 2007
@@ -114,7 +114,11 @@
 			if(log.isDebugEnabled()) log.debug("Exit: MakeConnectionProcessor::processInMessage, no
matching message found");
 			return false;
 		}
-		
+	
+		if (transaction != null && transaction.isActive()) {
+			transaction.commit();
+			transaction = storageManager.getTransaction();
+		}
 		replyToPoll(rmMsgCtx, senderBean, storageManager, pending, makeConnection.getNamespaceValue(),
transaction);
 		
 		if(log.isDebugEnabled()) log.debug("Exit: MakeConnectionProcessor::processInMessage");

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java?rev=577588&r1=577587&r2=577588&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
Thu Sep 20 00:08:44 2007
@@ -235,7 +235,7 @@
 				
 				if(entry != null) {
 					messageContext = entry.msgContext;
-					SOAPEnvelope clonedEnvelope = SandeshaUtil.cloneEnvelope(entry.envelope);
+					SOAPEnvelope clonedEnvelope = SandeshaUtil.copySOAPEnvelope(entry.envelope);
 					messageContext.setEnvelope(clonedEnvelope);
 				}
 			}

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java?rev=577588&r1=577587&r2=577588&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SandeshaUtil.java
Thu Sep 20 00:08:44 2007
@@ -25,8 +25,6 @@
 import java.util.Map;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.util.CopyUtils;
@@ -36,7 +34,6 @@
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -205,6 +202,8 @@
 			return "Fault";
 		case Sandesha2Constants.MessageTypes.MAKE_CONNECTION_MSG:
 			return "MakeConnection";
+		case Sandesha2Constants.MessageTypes.LAST_MESSAGE:
+			return "LastMessage";
 		case Sandesha2Constants.MessageTypes.UNKNOWN:
 			return "Unknown";
 		default:
@@ -994,22 +993,24 @@
 		
 	}
 
-        /** 
-         * Create a copy of the SOAPEnvelope
-         * @param sourceEnv
-         * @return targetEnv
-         */
-        private static SOAPEnvelope copySOAPEnvelope(SOAPEnvelope sourceEnv) {
-            if (log.isDebugEnabled()) {
-                log.debug("Start Create in-memory copy of the SOAPEnvelope");
-            }
-            // Delegate to the CopuUtils provided by Axiom
-            SOAPEnvelope targetEnv = CopyUtils.copy(sourceEnv);
-            if (log.isDebugEnabled()) {
-                log.debug("End Create in-memory copy of the SOAPEnvelope");
-            }
-            return targetEnv;
-        }
+	/** 
+	 * Create a copy of the SOAPEnvelope
+	 * @param sourceEnv
+	 * @return targetEnv
+	*/
+	public static SOAPEnvelope copySOAPEnvelope(SOAPEnvelope sourceEnv) {
+        if (log.isDebugEnabled()) 
+            log.debug("Enter: SandeshaUtil::copySOAPEnvelope");
+        
+        // Delegate to the CopuUtils provided by Axiom
+        SOAPEnvelope targetEnv = CopyUtils.copy(sourceEnv);
+        
+        if (log.isDebugEnabled()) 
+            log.debug("Exit: SandeshaUtil::copySOAPEnvelope");            
+		            
+		return targetEnv;
+	}
+
   /**
    * Remove the MustUnderstand header blocks.
    * @param envelope
@@ -1111,55 +1112,7 @@
 		}
 		else return false;
 	}	
-	
-	
-  public static SOAPEnvelope cloneEnvelope(SOAPEnvelope envelope) throws SandeshaException
{
-	    
-	    // Now clone the env and set it in the message context. We need to be sure that we
-    // close off the stream reader, in order to free up some of the heap.
-    XMLStreamReader streamReader = null;
-    SOAPEnvelope clonedEnvelope = null;
-    try {
-      streamReader = envelope.getXMLStreamReader();     
-      clonedEnvelope = new StAXSOAPModelBuilder(streamReader, null).getSOAPEnvelope();
-      // you have to explicitely set the 'processed' attribute for header
-      // blocks, since it get lost in the above read from the stream.
-     
-      SOAPHeader header = envelope.getHeader();
-      if (header != null) {
-        Iterator childrenOfOldEnv = header.getChildElements();
-        Iterator childrenOfNewEnv = clonedEnvelope.getHeader().getChildElements();
-        while (childrenOfOldEnv.hasNext()) {        
-          SOAPHeaderBlock oldEnvHeaderBlock = (SOAPHeaderBlock) childrenOfOldEnv.next();
-          SOAPHeaderBlock newEnvHeaderBlock = (SOAPHeaderBlock) childrenOfNewEnv.next();
-
-          QName oldEnvHeaderBlockQName = oldEnvHeaderBlock.getQName();
-          if (oldEnvHeaderBlockQName != null) {
-            if (oldEnvHeaderBlockQName.equals(newEnvHeaderBlock.getQName())) {
-              if (oldEnvHeaderBlock.isProcessed())
-                newEnvHeaderBlock.setProcessed();
-              } else {
-                String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cloneDoesNotMatchToOriginal);
-                throw new SandeshaException(message);
-              }
-            }
-          }
-        }
-        // Completely build the new tree
-        clonedEnvelope.build();
-      } finally {
-      if(streamReader != null) {
-        try {
-          streamReader.close();
-        } catch(XMLStreamException e) {
-          log.debug("Caught exception closing stream", e);
-        }
-      }
-
-    }
-    return clonedEnvelope;
-  }
-	  
+	 	  
 	public static final String getStackTraceFromException(Exception e) {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     PrintWriter pw = new PrintWriter(baos);



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message