Skip to content

Commit 482eff8

Browse files
committed
Await TcpClient shutdown in STOMP relay
1 parent c706cbb commit 482eff8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ public boolean isBrokerAvailable() {
128128
public final void start() {
129129
synchronized (this.lifecycleMonitor) {
130130
if (logger.isDebugEnabled()) {
131-
logger.debug("Starting " + getClass().getSimpleName());
131+
logger.debug("Starting");
132132
}
133133
startInternal();
134134
this.running = true;
135+
if (logger.isDebugEnabled()) {
136+
logger.debug("Started");
137+
}
135138
}
136139
}
137140

@@ -142,10 +145,13 @@ protected void startInternal() {
142145
public final void stop() {
143146
synchronized (this.lifecycleMonitor) {
144147
if (logger.isDebugEnabled()) {
145-
logger.debug("Stopping " + getClass().getSimpleName());
148+
logger.debug("Stopping");
146149
}
147150
stopInternal();
148151
this.running = false;
152+
if (logger.isDebugEnabled()) {
153+
logger.debug("Stopped");
154+
}
149155
}
150156
}
151157

spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Map;
2121
import java.util.concurrent.Callable;
2222
import java.util.concurrent.ConcurrentHashMap;
23+
import java.util.concurrent.TimeUnit;
2324

2425
import org.springframework.messaging.Message;
2526
import org.springframework.messaging.MessageChannel;
@@ -373,7 +374,7 @@ protected void stopInternal() {
373374
this.brokerChannel.unsubscribe(this);
374375

375376
try {
376-
this.tcpClient.shutdown();
377+
this.tcpClient.shutdown().get(5000, TimeUnit.MILLISECONDS);
377378
}
378379
catch (Throwable t) {
379380
logger.error("Error while shutting down TCP client", t);

0 commit comments

Comments
 (0)