mirror of https://github.com/apache/activemq.git
improvement for AMQ-1253 so that the ConnectionFactory can be configured with the warning timeout (or have the warning disabled all together)
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@541259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78cf4b1ac1
commit
9d53c53dc8
|
@ -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
|
||||
* <a href="http://activemq.apache.org/i-am-not-receiving-any-messages-what-is-wrong.html">start the connection</a>
|
||||
|
|
|
@ -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
|
||||
* <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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue