On Fri, Jan 16, 2009 at 8:27 AM, icfantv <adam.gor...@readytalk.com> wrote: > > I'm trying to create a connection such that it will time out if the ActiveMQ > server isn't running rather than blocking indefinitely. If I do it in a > background thread and it never connects, but rather, blocks indefinitely, > Java provides no way to terminate the thread. > > Not to harp on the developers, but this seems like a serious design flaw > especially since underneath it's probably using the Java network stack which > supports connection time outs. > > If anyone has any other ideas, I'm open to suggestions or I'm going to be > forced to delve into the code and perhaps implement some type of time out > mechanism on the connection.
Just to make sure I understand what you're asking, you don't want the client thread that's trying to connect to the broker to block until a connection is completed, correct? You must be using the failover transport to connect because it will block and wait for the connection to be made based on its configuration: http://activemq.apache.org/failover-transport-reference.html If you use the straight TCP transport without the failover transport the call will not block and wait: http://activemq.apache.org/tcp-transport-reference.html As far as connecting to the broker in an asynchronous manner when using the failover transport, such functionality does not exist currently. Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' Apache ActiveMQ - http://activemq.org/ Apache Camel - http://activemq.org/camel/ Apache ServiceMix - http://servicemix.org/ Blog: http://bruceblog.org/