@@ -196,38 +196,6 @@ public void close() {
196196
197197 @ Override
198198 public void run () {
199- ServerDescription currentServerDescription = unknownConnectingServerDescription (serverId , null );
200- try {
201- while (!isClosed ) {
202- ServerDescription previousServerDescription = currentServerDescription ;
203- currentServerDescription = lookupServerDescription (currentServerDescription );
204- boolean shouldStreamResponses = shouldStreamResponses (currentServerDescription );
205- if (shouldStreamResponses ) {
206- ensureRoundTripTimeMonitorStarted ();
207- }
208-
209- if (isClosed ) {
210- continue ;
211- }
212-
213- if (currentCheckCancelled ) {
214- waitForNext ();
215- currentCheckCancelled = false ;
216- continue ;
217- }
218-
219- // For POLL mode, if we just established initial connection, do an immediate heartbeat
220- boolean justConnected = previousServerDescription .getType () == UNKNOWN
221- && currentServerDescription .getType () != UNKNOWN
222- && !shouldStreamResponses
223- && connection != null && !connection .isClosed ();
224-
225- if (justConnected ) {
226- // Do immediate heartbeat for newly connected server in POLL mode
227- // to fire the ServerHeartbeatSucceededEvent
228- continue ;
229- }
230- boolean isPollMode = serverSettings .getServerMonitoringMode ().equals (ServerMonitoringMode .POLL );
231199 ServerDescription unknownConnectingServerDescription = unknownConnectingServerDescription (serverId , null );
232200 ServerDescription currentServerDescription = unknownConnectingServerDescription ;
233201 try {
@@ -250,7 +218,7 @@ public void run() {
250218 }
251219
252220 // For POLL mode, if we just established initial connection, do an immediate heartbeat
253- if (isPollMode && connection != null && !connection .isClosed ()
221+ if (! shouldStreamResponses && connection != null && !connection .isClosed ()
254222 && previousServerDescription .equals (unknownConnectingServerDescription )
255223 && currentServerDescription .equals (connection .getInitialServerDescription ())) {
256224 continue ;
0 commit comments