Title: [661] trunk/core/src/main/java/org/servicemix/jbi/messaging/DeliveryChannelImpl.java: Remove superfluous debug log when to transaction manager.
Revision
661
Author
gnt
Date
2005-10-25 15:40:17 -0400 (Tue, 25 Oct 2005)

Log Message

Remove superfluous debug log when to transaction manager.
Remove DeliveryChannelImpl dependency on ExchangePacket

Modified Paths

Diff

Modified: trunk/core/src/main/java/org/servicemix/jbi/messaging/DeliveryChannelImpl.java (660 => 661)

--- trunk/core/src/main/java/org/servicemix/jbi/messaging/DeliveryChannelImpl.java	2005-10-25 17:25:44 UTC (rev 660)
+++ trunk/core/src/main/java/org/servicemix/jbi/messaging/DeliveryChannelImpl.java	2005-10-25 19:40:17 UTC (rev 661)
@@ -246,7 +246,7 @@
 
     protected void doSend(MessageExchangeImpl messageExchange, boolean sync) throws MessagingException {
         // Auto enlist exchange in transaction
-        autoEnlistInTx(messageExchange.getPacket());
+        autoEnlistInTx(messageExchange);
         // Update persistence info
         Boolean persistent = messageExchange.getPersistent();
         if (persistent == null) {
@@ -331,7 +331,7 @@
             throw new MessagingException("DeliveryChannel is closed");
         }
     	MessageExchangeImpl messageExchangeImpl = (MessageExchangeImpl) messageExchange;
-    	autoEnlistInTx(messageExchangeImpl.getPacket());
+    	autoEnlistInTx(messageExchangeImpl);
         try {
             // Synchronously send a message and wait for the response
             synchronized (messageExchangeImpl) {
@@ -466,7 +466,7 @@
     /**
      * Used internally for passing in a MessageExchange
      * 
-     * @param packet
+     * @param me
      * @throws MessagingException
      */
     public void processInBound(MessageExchangeImpl me) throws MessagingException {
@@ -531,15 +531,16 @@
 
     protected void suspendTx(MessageExchangeImpl me) throws MessagingException {
     	try {
-            ExchangePacket packet = me.getPacket();
-			TransactionManager tm = (TransactionManager) container.getTransactionManager();
-			Object oldTx = packet.getTransactionContext();
-			if (tm != null && oldTx != null) {
-				Transaction tx = tm.suspend();
-				if (tx != oldTx) {
-					throw new IllegalStateException("the transaction context set in the messageExchange is not bound to the current thread");
-				}
-			}
+            Transaction oldTx = me.getTransactionContext();
+            if (oldTx != null) {
+                TransactionManager tm = (TransactionManager) container.getTransactionManager();
+    			if (tm != null) {
+    				Transaction tx = tm.suspend();
+    				if (tx != oldTx) {
+    					throw new IllegalStateException("the transaction context set in the messageExchange is not bound to the current thread");
+    				}
+    			}
+            }
     	} catch (Exception e) {
     		throw new MessagingException(e);
     	}
@@ -547,12 +548,13 @@
     
     protected void resumeTx(MessageExchangeImpl me) throws MessagingException {
     	try {
-            ExchangePacket packet = me.getPacket();
-			TransactionManager tm = (TransactionManager) container.getTransactionManager();
-			Object oldTx = packet.getTransactionContext();
-			if (tm != null && oldTx != null) {
-				tm.resume((Transaction) oldTx);
-			}
+			Transaction oldTx = me.getTransactionContext();
+            if (oldTx != null) {
+                TransactionManager tm = (TransactionManager) container.getTransactionManager();
+    			if (tm != null) {
+    				tm.resume(oldTx);
+    			}
+            }
     	} catch (Exception e) {
     		throw new MessagingException(e);
     	}
@@ -565,16 +567,16 @@
      * @param messageExchange
      * @throws MessagingException
      */
-    protected void autoEnlistInTx(ExchangePacket packet) throws MessagingException {
+    protected void autoEnlistInTx(MessageExchangeImpl me) throws MessagingException {
     	try {
         	if (container.isAutoEnlistInTransaction()) {
         		TransactionManager tm = (TransactionManager) container.getTransactionManager();
         		if (tm != null) {
         			Transaction tx = tm.getTransaction();
         			if (tx != null) {
-        				Object oldTx = packet.getTransactionContext();
+        				Object oldTx = me.getTransactionContext();
         				if (oldTx == null) {
-        					packet.setTransactionContext(tx);
+        					me.setTransactionContext(tx);
         				} else if (oldTx != tx) {
         					throw new IllegalStateException("the transaction context set in the messageExchange is not bound to the current thread");
         				}

Reply via email to