You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Rob Davies (JIRA)" <ji...@apache.org> on 2008/04/29 12:34:43 UTC

[jira] Assigned: (AMQ-1698) AMQ Threads prevent clean jvm termination

     [ https://issues.apache.org/activemq/browse/AMQ-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies reassigned AMQ-1698:
-------------------------------

    Assignee: Rob Davies

> AMQ Threads prevent clean jvm termination
> -----------------------------------------
>
>                 Key: AMQ-1698
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1698
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.0.0
>         Environment: Any
>            Reporter: Dominic Tulley
>            Assignee: Rob Davies
>
> 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 terminate.
> 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();
>    connection.start();
>    // 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);
>    producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>    TextMessage message = session.createTextMessage("Hello");
>    producer.send(message);
>           
>    producer.close();
>    session.close();
>    connection.close();
> }

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