@@ -140,26 +140,30 @@ private void tick() {
140
140
141
141
private void runDiscovery () {
142
142
lastUpdateTime = handler .instant ();
143
- final GrpcTransport transport = handler .createDiscoveryTransport ();
144
143
try {
145
- logger .debug ("execute list endpoints on {} with timeout {}" , transport , discoveryTimeout );
146
- DiscoveryProtos .ListEndpointsRequest request = DiscoveryProtos .ListEndpointsRequest .newBuilder ()
147
- .setDatabase (discoveryDatabase )
148
- .build ();
149
-
150
- GrpcRequestSettings grpcSettings = GrpcRequestSettings .newBuilder ()
151
- .withDeadline (discoveryTimeout )
152
- .build ();
153
-
154
- transport .unaryCall (DiscoveryServiceGrpc .getListEndpointsMethod (), grpcSettings , request )
155
- .whenComplete ((res , ex ) -> transport .close ()) // close transport for any result
156
- .thenApply (OperationBinder .bindSync (
157
- DiscoveryProtos .ListEndpointsResponse ::getOperation ,
158
- DiscoveryProtos .ListEndpointsResult .class
159
- ))
160
- .whenComplete (this ::handleDiscoveryResult );
144
+ final GrpcTransport transport = handler .createDiscoveryTransport ();
145
+ try {
146
+ logger .debug ("execute list endpoints on {} with timeout {}" , transport , discoveryTimeout );
147
+ DiscoveryProtos .ListEndpointsRequest request = DiscoveryProtos .ListEndpointsRequest .newBuilder ()
148
+ .setDatabase (discoveryDatabase )
149
+ .build ();
150
+
151
+ GrpcRequestSettings grpcSettings = GrpcRequestSettings .newBuilder ()
152
+ .withDeadline (discoveryTimeout )
153
+ .build ();
154
+
155
+ transport .unaryCall (DiscoveryServiceGrpc .getListEndpointsMethod (), grpcSettings , request )
156
+ .whenComplete ((res , ex ) -> transport .close ()) // close transport for any result
157
+ .thenApply (OperationBinder .bindSync (
158
+ DiscoveryProtos .ListEndpointsResponse ::getOperation ,
159
+ DiscoveryProtos .ListEndpointsResult .class
160
+ ))
161
+ .whenComplete (this ::handleDiscoveryResult );
162
+ } catch (Throwable th ) {
163
+ transport .close ();
164
+ throw th ;
165
+ }
161
166
} catch (Throwable th ) {
162
- transport .close ();
163
167
handleDiscoveryResult (null , th );
164
168
}
165
169
}
0 commit comments