camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sully6...@apache.org
Subject svn commit: r1390568 - in /camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms: SjmsComponent.java SjmsConsumer.java SjmsEndpoint.java SjmsProducer.java consumer/DefaultConsumer.java
Date Wed, 26 Sep 2012 15:35:53 GMT
Author: sully6768
Date: Wed Sep 26 15:35:53 2012
New Revision: 1390568

URL: http://svn.apache.org/viewvc?rev=1390568&view=rev
Log:
Refactored commitStrategy to transactionCommitStrategy

Modified:
    camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
    camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
    camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
    camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
    camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/DefaultConsumer.java

Modified: camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java?rev=1390568&r1=1390567&r2=1390568&view=diff
==============================================================================
--- camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
(original)
+++ camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsComponent.java
Wed Sep 26 15:35:53 2012
@@ -25,7 +25,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.component.sjms.jms.ConnectionFactoryResource;
 import org.apache.camel.component.sjms.jms.ConnectionResource;
-import org.apache.camel.component.sjms.tx.DefaultTransactionCommitStrategy;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
@@ -44,7 +43,7 @@ public class SjmsComponent extends Defau
     private HeaderFilterStrategy headerFilterStrategy = new SjmsHeaderFilterStrategy();
     private KeyFormatStrategy keyFormatStrategy;
     private Integer maxConnections = 1;
-    private TransactionCommitStrategy transactionCommitStrategy = new DefaultTransactionCommitStrategy();
+    private TransactionCommitStrategy transactionCommitStrategy;
 
     /**
      * @see
@@ -65,6 +64,9 @@ public class SjmsComponent extends Defau
         if (endpoint.isTransacted()) {
             endpoint.setSynchronous(true);
         }
+        if (transactionCommitStrategy != null) {
+            endpoint.setTransactionCommitStrategy(transactionCommitStrategy);
+        }
         return endpoint;
     }
 

Modified: camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java?rev=1390568&r1=1390567&r2=1390568&view=diff
==============================================================================
--- camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
(original)
+++ camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
Wed Sep 26 15:35:53 2012
@@ -89,8 +89,8 @@ public class SjmsConsumer extends Defaul
         return getSjmsEndpoint().getDurableSubscriptionId();
     }
 
-    public TransactionCommitStrategy getCommitStrategy() {
-        return getSjmsEndpoint().getCommitStrategy();
+    public TransactionCommitStrategy getTransactionCommitStrategy() {
+        return getSjmsEndpoint().getTransactionCommitStrategy();
     }
 
     public int getTransactionBatchCount() {

Modified: camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java?rev=1390568&r1=1390567&r2=1390568&view=diff
==============================================================================
--- camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
(original)
+++ camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
Wed Sep 26 15:35:53 2012
@@ -55,7 +55,7 @@ public class SjmsEndpoint extends Defaul
     private long responseTimeOut = 5000;
     private String messageSelector;
     private int transactionBatchCount = -1;
-    private TransactionCommitStrategy commitStrategy;
+    private TransactionCommitStrategy transactionCommitStrategy;
 
     public SjmsEndpoint() {
         super();
@@ -262,12 +262,12 @@ public class SjmsEndpoint extends Defaul
         return messageSelector;
     }
 
-    public TransactionCommitStrategy getCommitStrategy() {
-        return commitStrategy;
+    public TransactionCommitStrategy getTransactionCommitStrategy() {
+        return transactionCommitStrategy;
     }
 
-    public void setCommitStrategy(TransactionCommitStrategy commitStrategy) {
-        this.commitStrategy = commitStrategy;
+    public void setTransactionCommitStrategy(TransactionCommitStrategy commitStrategy) {
+        this.transactionCommitStrategy = commitStrategy;
     }
 
     public int getTransactionBatchCount() {

Modified: camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java?rev=1390568&r1=1390567&r2=1390568&view=diff
==============================================================================
--- camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
(original)
+++ camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsProducer.java
Wed Sep 26 15:35:53 2012
@@ -386,7 +386,7 @@ public abstract class SjmsProducer exten
      * @return TransactionCommitStrategy
      */
     public TransactionCommitStrategy getCommitStrategy() {
-        return getSjmsEndpoint().getCommitStrategy();
+        return getSjmsEndpoint().getTransactionCommitStrategy();
     }
 
 }

Modified: camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/DefaultConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/DefaultConsumer.java?rev=1390568&r1=1390567&r2=1390568&view=diff
==============================================================================
--- camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/DefaultConsumer.java
(original)
+++ camel/trunk/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/consumer/DefaultConsumer.java
Wed Sep 26 15:35:53 2012
@@ -160,6 +160,13 @@ public class DefaultConsumer extends Sjm
         super.doSuspend();
     }
 
+    /**
+     * Creates a {@link MessageConsumerResources} with a dedicated
+     * {@link Session} required for transacted and InOut consumers.
+     * 
+     * @return MessageConsumerResources
+     * @throws Exception
+     */
     private MessageConsumerResources createConsumerWithDedicatedSession() throws Exception
{
         Connection conn = getConnectionResource().borrowConnection();
         Session session = null;
@@ -180,6 +187,13 @@ public class DefaultConsumer extends Sjm
         return new MessageConsumerResources(session, messageConsumer);
     }
 
+    /**
+     * Creates a {@link MessageConsumerResources} with a shared {@link Session}
+     * for non-transacted InOnly consumers.
+     * 
+     * @return
+     * @throws Exception
+     */
     private MessageConsumerResources createConsumerListener() throws Exception {
         Session queueSession = getSessionPool().borrowObject();
         MessageConsumer messageConsumer = null;
@@ -202,16 +216,16 @@ public class DefaultConsumer extends Sjm
      * @return
      */
     protected MessageListener createMessageHandler(Session session) {
-        
+
         TransactionCommitStrategy commitStrategy = null;
-        if (this.getCommitStrategy() != null) {
-            commitStrategy = this.getCommitStrategy();
+        if (this.getTransactionCommitStrategy() != null) {
+            commitStrategy = this.getTransactionCommitStrategy();
         } else if (this.getTransactionBatchCount() > 0) {
             commitStrategy = new BatchTransactionCommitStrategy(this.getTransactionBatchCount());
         } else {
             commitStrategy = new DefaultTransactionCommitStrategy();
         }
-        
+
         DefaultMessageHandler messageHandler = null;
         if (getSjmsEndpoint().getExchangePattern().equals(ExchangePattern.InOnly)) {
             if (isTransacted()) {



Mime
View raw message