Saar peer
Saar peer

Reputation: 847

ActiveMQ broker stop is not working

I am getting :

java.io.IOException: Failed to bind to server socket: nio://localhost:62626 due to: java.net.BindException: Address already in use

My code :

DSMBrokerService broker = new SslBrokerService();
broker.addConnector("nio://localhost:62626");
broker.start();
broker.waitUntilStarted();

broker.stop();
broker.waitUntilStopped();

... (Do stuff)...

DSMBrokerService broker = new SslBrokerService();
broker.addConnector("nio://localhost:62626"); <- Exception
broker.start();
broker.waitUntilStarted()

Why does broker.stop() not unbind the Address ?

Upvotes: 2

Views: 551

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

Stopping the broker does not remove the connector. When you restart it again it fires up two connectors on that port.

Upvotes: 1

Related Questions