@@ -61,8 +61,6 @@ public class BigtableChannelPool extends ManagedChannel {
6161 private final BigtableChannelPoolSettings settings ;
6262 private final ChannelFactory channelFactory ;
6363 private final ScheduledExecutorService executor ;
64- private final ScheduledExecutorService channelHealthProbingExecutor =
65- Executors .newSingleThreadScheduledExecutor ();
6664
6765 private final Object entryWriteLock = new Object ();
6866 @ VisibleForTesting final AtomicReference <ImmutableList <Entry >> entries = new AtomicReference <>();
@@ -97,7 +95,7 @@ public static BigtableChannelPool create(
9795
9896 for (int i = 0 ; i < settings .getInitialChannelCount (); i ++) {
9997 initialListBuilder .add (
100- new Entry (channelFactory .createSingleChannel (), channelHealthProbingExecutor ));
98+ new Entry (channelFactory .createSingleChannel ()));
10199 }
102100
103101 entries .set (initialListBuilder .build ());
@@ -155,9 +153,6 @@ public ManagedChannel shutdown() {
155153 // shutdownNow will cancel scheduled tasks
156154 executor .shutdownNow ();
157155 }
158- if (channelHealthProbingExecutor != null ) {
159- channelHealthProbingExecutor .shutdownNow ();
160- }
161156 return this ;
162157 }
163158
@@ -198,9 +193,6 @@ public ManagedChannel shutdownNow() {
198193 if (executor != null ) {
199194 executor .shutdownNow ();
200195 }
201- if (channelHealthProbingExecutor != null ) {
202- channelHealthProbingExecutor .shutdownNow ();
203- }
204196 return this ;
205197 }
206198
@@ -328,7 +320,7 @@ private void expand(int desiredSize) {
328320 for (int i = 0 ; i < desiredSize - localEntries .size (); i ++) {
329321 try {
330322 newEntries .add (
331- new Entry (channelFactory .createSingleChannel (), channelHealthProbingExecutor ));
323+ new Entry (channelFactory .createSingleChannel ()));
332324 } catch (IOException e ) {
333325 LOG .log (Level .WARNING , "Failed to add channel" , e );
334326 }
@@ -367,7 +359,7 @@ void refresh() {
367359 for (int i = 0 ; i < newEntries .size (); i ++) {
368360 try {
369361 newEntries .set (
370- i , new Entry (channelFactory .createSingleChannel (), channelHealthProbingExecutor ));
362+ i , new Entry (channelFactory .createSingleChannel ()));
371363 } catch (IOException e ) {
372364 LOG .log (Level .WARNING , "Failed to refresh channel, leaving old channel" , e );
373365 }
@@ -445,26 +437,38 @@ static class Entry {
445437 private final AtomicInteger maxOutstanding = new AtomicInteger ();
446438 private final AtomicInteger probesInFlight = new AtomicInteger (0 );
447439
440+ /** Number of probes in flight plus number of probe results. (No-op stub) */
441+ AtomicInteger recentProbesSent () {
442+ return new AtomicInteger (0 );
443+ }
444+
445+ /** Number of recently failed probes. (No-op stub) */
446+ AtomicInteger recentlyFailedProbes () {
447+ return new AtomicInteger (0 );
448+ }
449+
450+ /**
451+ * Determines if the channel is healthy. (No-op stub)
452+ *
453+ * @return A default value of true.
454+ */
455+ public boolean healthy () {
456+ return true ;
457+ }
458+
448459 // Flag that the channel should be closed once all of the outstanding RPC complete.
449460 private final AtomicBoolean shutdownRequested = new AtomicBoolean ();
450461 // Flag that the channel has been closed.
451462 private final AtomicBoolean shutdownInitiated = new AtomicBoolean ();
452- private final ChannelHealthChecker healthChecker ;
453463
454- private Entry (ManagedChannel channel , ScheduledExecutorService executor ) {
464+ private Entry (ManagedChannel channel ) {
455465 this .channel = channel ;
456- this .healthChecker = new ChannelHealthChecker (this , executor );
457466 }
458467
459468 ManagedChannel getManagedChannel () {
460469 return this .channel ;
461470 }
462471
463- // Add a getter for the healthChecker
464- public ChannelHealthChecker getHealthChecker () {
465- return healthChecker ;
466- }
467-
468472 int getAndResetMaxOutstanding () {
469473 return maxOutstanding .getAndSet (outstandingRpcs .get ());
470474 }
0 commit comments