Await TcpClient shutdown in STOMP broker relay
This commit is contained in:
@@ -128,10 +128,13 @@ public abstract class AbstractBrokerMessageHandler
|
||||
public final void start() {
|
||||
synchronized (this.lifecycleMonitor) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Starting " + getClass().getSimpleName());
|
||||
logger.debug("Starting");
|
||||
}
|
||||
startInternal();
|
||||
this.running = true;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Started");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +145,13 @@ public abstract class AbstractBrokerMessageHandler
|
||||
public final void stop() {
|
||||
synchronized (this.lifecycleMonitor) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Stopping " + getClass().getSimpleName());
|
||||
logger.debug("Stopping");
|
||||
}
|
||||
stopInternal();
|
||||
this.running = false;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Stopped");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -384,7 +385,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
||||
this.brokerChannel.unsubscribe(this);
|
||||
|
||||
try {
|
||||
this.tcpClient.shutdown();
|
||||
this.tcpClient.shutdown().get(5000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
logger.error("Error while shutting down TCP client", t);
|
||||
|
||||
Reference in New Issue
Block a user