@@ -234,6 +234,7 @@ public void run() {
234
234
IDLE_GRACE_PERIOD_MILLIS , TimeUnit .MILLISECONDS );
235
235
return ;
236
236
}
237
+ log .log (Level .FINE , "[{0}] Entering idle mode" , getLogId ());
237
238
// Enter idle mode
238
239
savedBalancer = graceLoadBalancer ;
239
240
graceLoadBalancer = null ;
@@ -288,6 +289,7 @@ LoadBalancer<ClientTransport> exitIdleMode() {
288
289
if (loadBalancer != null ) {
289
290
return loadBalancer ;
290
291
}
292
+ log .log (Level .FINE , "[{0}] Exiting idle mode" , getLogId ());
291
293
balancer = loadBalancerFactory .newLoadBalancer (nameResolver .getServiceAuthority (), tm );
292
294
this .loadBalancer = balancer ;
293
295
resolver = this .nameResolver ;
@@ -472,6 +474,7 @@ static NameResolver getNameResolver(String target, NameResolver.Factory nameReso
472
474
*/
473
475
@ Override
474
476
public ManagedChannelImpl shutdown () {
477
+ log .log (Level .FINE , "[{0}] shutdown() called" , getLogId ());
475
478
ArrayList <TransportSet > transportsCopy = new ArrayList <TransportSet >();
476
479
ArrayList <DelayedClientTransport > delayedTransportsCopy =
477
480
new ArrayList <DelayedClientTransport >();
@@ -483,6 +486,7 @@ public ManagedChannelImpl shutdown() {
483
486
if (shutdown ) {
484
487
return this ;
485
488
}
489
+ log .log (Level .FINE , "[{0}] Shutting down" , getLogId ());
486
490
shutdown = true ;
487
491
// After shutdown there are no new calls, so no new cancellation tasks are needed
488
492
scheduledExecutor = SharedResourceHolder .release (timerService , scheduledExecutor );
@@ -524,6 +528,7 @@ public ManagedChannelImpl shutdown() {
524
528
*/
525
529
@ Override
526
530
public ManagedChannelImpl shutdownNow () {
531
+ log .log (Level .FINE , "[{0}] shutdownNow() called" , getLogId ());
527
532
synchronized (lock ) {
528
533
// Short-circuiting not strictly necessary, but prevents transports from needing to handle
529
534
// multiple shutdownNow invocations.
@@ -751,7 +756,7 @@ public LogId getLogId() {
751
756
return logId ;
752
757
}
753
758
754
- private static class NameResolverListenerImpl implements NameResolver .Listener {
759
+ private class NameResolverListenerImpl implements NameResolver .Listener {
755
760
final LoadBalancer <ClientTransport > balancer ;
756
761
757
762
NameResolverListenerImpl (LoadBalancer <ClientTransport > balancer ) {
@@ -764,10 +769,13 @@ public void onUpdate(List<ResolvedServerInfoGroup> servers, Attributes config) {
764
769
onError (Status .UNAVAILABLE .withDescription ("NameResolver returned an empty list" ));
765
770
return ;
766
771
}
772
+ log .log (Level .FINE , "[{0}] resolved address: {1}, config={2}" ,
773
+ new Object [] {getLogId (), servers , config });
767
774
768
775
try {
769
776
balancer .handleResolvedAddresses (servers , config );
770
777
} catch (Throwable e ) {
778
+ log .log (Level .WARNING , "[" + getLogId () + "] Unexpected exception from LoadBalancer" , e );
771
779
// It must be a bug! Push the exception back to LoadBalancer in the hope that it may be
772
780
// propagated to the application.
773
781
balancer .handleNameResolutionError (Status .INTERNAL .withCause (e )
@@ -778,6 +786,8 @@ public void onUpdate(List<ResolvedServerInfoGroup> servers, Attributes config) {
778
786
@ Override
779
787
public void onError (Status error ) {
780
788
checkArgument (!error .isOk (), "the error status must not be OK" );
789
+ log .log (Level .WARNING , "[{0}] Failed to resolve name. status={1}" ,
790
+ new Object [] {getLogId (), error });
781
791
balancer .handleNameResolutionError (error );
782
792
}
783
793
}
0 commit comments