Author: jstrachan
Date: Thu May 24 03:28:32 2007
New Revision: 541259

URL: http://svn.apache.org/viewvc?view=rev&rev=541259
Log:
improvement for AMQ-1253 so that the ConnectionFactory can be configured with 
the warning timeout (or have the warning disabled all together)

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

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=541259&r1=541258&r2=541259
==============================================================================
--- 
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 May 24 03:28:32 2007
@@ -1514,7 +1514,7 @@
     }
 
     /**
-     * Enables the timemout from a session creation to when a warning is 
generated
+     * Enables the timemout from a connection creation to when a warning is 
generated
      * if the connection is not properly started via [EMAIL PROTECTED] 
#start()}. It is a very
      * common gotcha to forget to
      * <a 
href="http://activemq.apache.org/i-am-not-receiving-any-messages-what-is-wrong.html";>start
 the connection</a>

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=541259&r1=541258&r2=541259
==============================================================================
--- 
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 May 24 03:28:32 2007
@@ -92,6 +92,7 @@
     private boolean alwaysSyncSend;
     private boolean watchTopicAdvisories=true;
     private int producerWindowSize=DEFAULT_PRODUCER_WINDOW_SIZE;
+    private long warnAboutUnstartedConnectionTimeout = 500L;
 
     static protected final Executor DEFAULT_CONNECTION_EXECUTOR = new 
ScheduledThreadPoolExecutor(5, new ThreadFactory() {
             public Thread newThread(Runnable run) {
@@ -267,6 +268,7 @@
             connection.setBlobTransferPolicy(getBlobTransferPolicy().copy());
             connection.setWatchTopicAdvisories(watchTopicAdvisories);
             connection.setProducerWindowSize(producerWindowSize);
+            
connection.setWarnAboutUnstartedConnectionTimeout(getWarnAboutUnstartedConnectionTimeout());
             transport.start();
 
             if( clientID !=null )
@@ -756,4 +758,21 @@
        synchronized public void setProducerWindowSize(int producerWindowSize) {
                this.producerWindowSize = producerWindowSize;
        }
+
+
+    public long getWarnAboutUnstartedConnectionTimeout() {
+        return warnAboutUnstartedConnectionTimeout;
+    }
+
+    /**
+     * Enables the timemout from a connection creation to when a warning is 
generated
+     * if the connection is not properly started via [EMAIL PROTECTED] 
Connection#start()}. It is a very
+     * common gotcha to forget to
+     * <a 
href="http://activemq.apache.org/i-am-not-receiving-any-messages-what-is-wrong.html";>start
 the connection</a>
+     * so this option makes the default case to create a warning if the user 
forgets.
+     * To disable the warning just set the value to < 0 (say -1).
+     */
+    public void setWarnAboutUnstartedConnectionTimeout(long 
warnAboutUnstartedConnectionTimeout) {
+        this.warnAboutUnstartedConnectionTimeout = 
warnAboutUnstartedConnectionTimeout;
+    }
 }


Reply via email to