You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractClientConnectionFactory.java
Copy file name to clipboardExpand all lines: spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionSupport.java
+33Lines changed: 33 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,8 @@ public abstract class TcpConnectionSupport implements TcpConnection {
78
78
79
79
privateTcpListenerlistener;
80
80
81
+
privatevolatileTcpListenertestListener;
82
+
81
83
privateTcpSendersender;
82
84
83
85
privateStringconnectionId;
@@ -92,6 +94,13 @@ public abstract class TcpConnectionSupport implements TcpConnection {
92
94
93
95
privatebooleanmanualListenerRegistration;
94
96
97
+
/*
98
+
* This boolean is to avoid looking for a temporary listener when not needed
99
+
* to avoid a CPU cache flush. This does not have to be volatile because it
100
+
* is reset by the thread that checks for the temporary listener.
101
+
*/
102
+
privatebooleanneedsTest;
103
+
95
104
publicTcpConnectionSupport() {
96
105
this(null);
97
106
}
@@ -238,6 +247,15 @@ public void setSerializer(Serializer<?> serializer) {
238
247
}
239
248
}
240
249
250
+
/**
251
+
* Set to true to use a temporary listener for just the first incoming message.
252
+
* @param needsTest true for a temporary listener.
253
+
* @since 5.3
254
+
*/
255
+
publicvoidsetNeedsTest(booleanneedsTest) {
256
+
this.needsTest = needsTest;
257
+
}
258
+
241
259
/**
242
260
* Set the listener that will receive incoming Messages.
243
261
* @param listener The listener.
@@ -247,6 +265,17 @@ public void registerListener(@Nullable TcpListener listener) {
247
265
this.listenerRegisteredLatch.countDown();
248
266
}
249
267
268
+
/**
269
+
* Set a temporary listener to receive just the first incoming message.
270
+
* Used in conjunction with a connectionTest in a client connection
0 commit comments