activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r513543 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: ActiveMQConnection.java ActiveMQConnectionFactory.java ActiveMQSession.java
Date Thu, 01 Mar 2007 23:15:52 GMT
Author: rajdavies
Date: Thu Mar  1 14:43:47 2007
New Revision: 513543

URL: http://svn.apache.org/viewvc?view=rev&rev=513543
Log:
provide the option to always send messages synchronously - even if the messages are 
non-persistent

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?view=diff&rev=513543&r1=513542&r2=513543
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Thu Mar  1 14:43:47 2007
@@ -132,6 +132,7 @@
     private boolean optimizeAcknowledge = false;
     private boolean nestedMapAndListEnabled = true;
     private boolean useRetroactiveConsumer;
+    private boolean alwaysSyncSend;
     private int closeTimeout = 15000;
     
     private final Transport transport;
@@ -1301,6 +1302,22 @@
     public void setUseAsyncSend(boolean useAsyncSend) {
         this.useAsyncSend = useAsyncSend;
     }
+    
+    /**
+     * @return true if always sync send messages
+     */
+    public boolean isAlwaysSyncSend(){
+        return this.alwaysSyncSend;
+    }
+
+    /**
+     * Set true if always require messages to be sync sent
+     * @param alwaysSyncSend
+     */
+    public void setAlwaysSyncSend(boolean alwaysSyncSend){
+        this.alwaysSyncSend=alwaysSyncSend;
+    }
+
 
     /**
      * Cleans up this connection so that it's state is as if the connection was
@@ -1929,8 +1946,5 @@
     
     public String toString() {
         return "ActiveMQConnection {id="+info.getConnectionId()+",clientId="+info.getClientId()+",started="+started.get()+"}";
-    }
-
-
-    
+    }    
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java?view=diff&rev=513543&r1=513542&r2=513543
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
Thu Mar  1 14:43:47 2007
@@ -87,6 +87,7 @@
     private boolean useRetroactiveConsumer;
     private boolean nestedMapAndListEnabled = true;
     JMSStatsImpl factoryStats = new JMSStatsImpl();
+    private boolean alwaysSyncSend;
 
     static protected final Executor DEFAULT_CONNECTION_EXECUTOR = new ScheduledThreadPoolExecutor(5,
new ThreadFactory() {
             public Thread newThread(Runnable run) {
@@ -425,6 +426,21 @@
     public void setUseAsyncSend(boolean useAsyncSend) {
         this.useAsyncSend = useAsyncSend;
     }
+    
+    /**
+     * @return true if always sync send messages
+     */
+    public boolean isAlwaysSyncSend(){
+        return this.alwaysSyncSend;
+    }
+
+    /**
+     * Set true if always require messages to be sync sent
+     * @param alwaysSyncSend
+     */
+    public void setAlwaysSyncSend(boolean alwaysSyncSend){
+        this.alwaysSyncSend=alwaysSyncSend;
+    }
 
     public String getUserName() {
         return userName;
@@ -553,6 +569,7 @@
         props.setProperty("alwaysSessionAsync", Boolean.toString(isAlwaysSessionAsync()));
         props.setProperty("optimizeAcknowledge", Boolean.toString(isOptimizeAcknowledge()));
         props.setProperty("statsEnabled",Boolean.toString(isStatsEnabled()));
+        props.setProperty("alwaysSyncSend",Boolean.toString(isAlwaysSyncSend()));
 
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java?view=diff&rev=513543&r1=513542&r2=513543
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java Thu
Mar  1 14:43:47 2007
@@ -1594,11 +1594,11 @@
 			if(this.debug){
 				log.debug("Sending message: "+msg);
 			}
-			if(!msg.isPersistent()||connection.isUseAsyncSend()||txid!=null){
-				this.connection.asyncSendPacket(msg);
-			}else{
-				this.connection.syncSendPacket(msg);
-			}
+			if(!connection.isAlwaysSyncSend()&&(!msg.isPersistent()||connection.isUseAsyncSend()||txid!=null)){
+                this.connection.asyncSendPacket(msg);
+            }else{
+                this.connection.syncSendPacket(msg);
+            }
 		}
 	}
 



Mime
View raw message