diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
index 99d5bb64a3..d1218cf400 100755
--- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
+++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
@@ -1514,7 +1514,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
}
/**
- * 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 {@link #start()}. It is a very
* common gotcha to forget to
* start the connection
diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
index 439ae21e31..40a5e056ce 100755
--- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
+++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
@@ -92,6 +92,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
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 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
connection.setBlobTransferPolicy(getBlobTransferPolicy().copy());
connection.setWatchTopicAdvisories(watchTopicAdvisories);
connection.setProducerWindowSize(producerWindowSize);
+ connection.setWarnAboutUnstartedConnectionTimeout(getWarnAboutUnstartedConnectionTimeout());
transport.start();
if( clientID !=null )
@@ -756,4 +758,21 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
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 {@link Connection#start()}. It is a very
+ * common gotcha to forget to
+ * start the connection
+ * 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;
+ }
}