activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rabidgremlin <rabidgrem...@gmail.com>
Subject Exception on broker shutdown
Date Thu, 14 Sep 2006 21:26:08 GMT
Hi all,

When shutting down an embedded broker with active clients I get an exception
thrown.

Is there a way to more gracefully disconnect clients ?

Logs from my test app:

60342 [main] INFO TestBroker  - Shutting down broker...
60342 [main] INFO org.apache.activemq.broker.BrokerService  - ActiveMQ
Message Broker (localhost, ID:isis-ws-007-4339-1158268488310-0:0) is
shutting down
61623 [ActiveMQ Transport: tcp:///127.0.0.1:4343] DEBUG
org.apache.activemq.broker.AbstractConnection.Transport  - Transport failed:
java.net.SocketException: Socket closed
java.net.SocketException: Socket closed
    at java.net.SocketInputStream.read(SocketInputStream.java:162)
    at org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(
TcpBufferedInputStream.java:48)
    at org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(
TcpBufferedInputStream.java:55)
    at java.io.DataInputStream.readInt(DataInputStream.java:443)
    at org.apache.activemq.openwire.OpenWireFormat.unmarshal(
OpenWireFormat.java:274)
    at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java
:142)
    at java.lang.Thread.run(Thread.java:534)
61639 [main] INFO org.apache.activemq.broker.TransportConnector  - Connector
tcp://isis-ws-007:12345 Stopped
61639 [main] INFO org.apache.activemq.transport.vm.VMTransportFactory  -
Shutting down VM connectors for broker: localhost
61655 [main] INFO org.apache.activemq.broker.BrokerService  - ActiveMQ JMS
Message Broker (localhost, ID:isis-ws-007-4339-1158268488310-0:0) stopped
61655 [main] INFO TestBroker  - Done


and the code for the app:

import org.apache.activemq.broker.BrokerService;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

/**
 * Test broker that runs for a limited amount of time and then shuts down.
 *
 * @author ackerj
 * @version $Id$
 */
public class TestBroker
{
  private static Logger log = Logger.getLogger(TestBroker.class);

  private static int MINUTES_TO_RUN = 1;

  public static void main(String[] args)
    throws Exception
  {
    BasicConfigurator.configure();

    System.out.println("Test ActiveMQ Broker");

    if (args.length != 1 && args.length != 2)
    {
      System.out.println("Usage: TestBroker [listenport] <clusterurl>");
      System.out.println("eg: ");
      System.out.println("   TestBroker 12345");
      System.exit(1);
    }

    String connectorUri = "tcp://127.0.0.1:" + args[0];
    log.info("Connector URI: " + connectorUri);
    BrokerService broker = new BrokerService();
    broker.setUseJmx(false);
    broker.setPersistent(false);
    broker.addConnector(connectorUri);

    log.info("Running broker for " + MINUTES_TO_RUN + " minutes...");
    broker.start();

    Thread.sleep(MINUTES_TO_RUN * 60 * 1000);

    log.info("Shutting down broker...");
    broker.stop();
    log.info("Done");
  }

}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message