activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominic Tulley (JIRA)" <>
Subject [jira] Created: (AMQ-1698) AMQ Threads prevent clean jvm termination
Date Tue, 29 Apr 2008 09:14:43 GMT
AMQ Threads prevent clean jvm termination

                 Key: AMQ-1698
             Project: ActiveMQ
          Issue Type: Bug
          Components: JMS client
    Affects Versions: 5.0.0
         Environment: Any
            Reporter: Dominic Tulley

A java process using the AMQ client and connecting to a broker will end up with a couple of
threads running called "InactivityMonitor WriteCheck" and "InactivityMonitor ReadCheck".

When the main jvm thread finishes and the jvm tries to exit, these two threads have not stopped
running and, because they are not daemon threads, the jvm is not able to exit.  The process
ends up hanging - mostly shut down but not quite.

This is easily reproduced with the most trivial of messaging code (See below) which will not
Changing the creation of these two threads (which arise from the instantiation of Timers really)
to make them daemons resolves the problem.

Sample Code

public static void main(String [] args)
   ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("","","tcp://localhost:61616");
   Connection connection = connectionFactory.createConnection();

   // Create the session
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   Destination destination = session.createQueue("TEST_QUEUE");

   // Create the producer.
   MessageProducer producer = session.createProducer(destination);

   TextMessage message = session.createTextMessage("Hello");

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message