1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.cloud.dialogflow.v2.stub; 18 19 import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListLocationsPagedResponse; 20 import static com.google.cloud.dialogflow.v2.ParticipantsClient.ListParticipantsPagedResponse; 21 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.core.BackgroundResourceAggregation; 24 import com.google.api.gax.grpc.GrpcCallSettings; 25 import com.google.api.gax.grpc.GrpcStubCallableFactory; 26 import com.google.api.gax.rpc.BidiStreamingCallable; 27 import com.google.api.gax.rpc.ClientContext; 28 import com.google.api.gax.rpc.UnaryCallable; 29 import com.google.cloud.dialogflow.v2.AnalyzeContentRequest; 30 import com.google.cloud.dialogflow.v2.AnalyzeContentResponse; 31 import com.google.cloud.dialogflow.v2.CreateParticipantRequest; 32 import com.google.cloud.dialogflow.v2.GetParticipantRequest; 33 import com.google.cloud.dialogflow.v2.ListParticipantsRequest; 34 import com.google.cloud.dialogflow.v2.ListParticipantsResponse; 35 import com.google.cloud.dialogflow.v2.Participant; 36 import com.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest; 37 import com.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse; 38 import com.google.cloud.dialogflow.v2.SuggestArticlesRequest; 39 import com.google.cloud.dialogflow.v2.SuggestArticlesResponse; 40 import com.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest; 41 import com.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse; 42 import com.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; 43 import com.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; 44 import com.google.cloud.dialogflow.v2.UpdateParticipantRequest; 45 import com.google.cloud.location.GetLocationRequest; 46 import com.google.cloud.location.ListLocationsRequest; 47 import com.google.cloud.location.ListLocationsResponse; 48 import com.google.cloud.location.Location; 49 import com.google.common.collect.ImmutableMap; 50 import com.google.longrunning.stub.GrpcOperationsStub; 51 import io.grpc.MethodDescriptor; 52 import io.grpc.protobuf.ProtoUtils; 53 import java.io.IOException; 54 import java.util.concurrent.TimeUnit; 55 import javax.annotation.Generated; 56 57 // AUTO-GENERATED DOCUMENTATION AND CLASS. 58 /** 59 * gRPC stub implementation for the Participants service API. 60 * 61 * <p>This class is for advanced usage and reflects the underlying API directly. 62 */ 63 @Generated("by gapic-generator-java") 64 public class GrpcParticipantsStub extends ParticipantsStub { 65 private static final MethodDescriptor<CreateParticipantRequest, Participant> 66 createParticipantMethodDescriptor = 67 MethodDescriptor.<CreateParticipantRequest, Participant>newBuilder() 68 .setType(MethodDescriptor.MethodType.UNARY) 69 .setFullMethodName("google.cloud.dialogflow.v2.Participants/CreateParticipant") 70 .setRequestMarshaller( 71 ProtoUtils.marshaller(CreateParticipantRequest.getDefaultInstance())) 72 .setResponseMarshaller(ProtoUtils.marshaller(Participant.getDefaultInstance())) 73 .build(); 74 75 private static final MethodDescriptor<GetParticipantRequest, Participant> 76 getParticipantMethodDescriptor = 77 MethodDescriptor.<GetParticipantRequest, Participant>newBuilder() 78 .setType(MethodDescriptor.MethodType.UNARY) 79 .setFullMethodName("google.cloud.dialogflow.v2.Participants/GetParticipant") 80 .setRequestMarshaller( 81 ProtoUtils.marshaller(GetParticipantRequest.getDefaultInstance())) 82 .setResponseMarshaller(ProtoUtils.marshaller(Participant.getDefaultInstance())) 83 .build(); 84 85 private static final MethodDescriptor<ListParticipantsRequest, ListParticipantsResponse> 86 listParticipantsMethodDescriptor = 87 MethodDescriptor.<ListParticipantsRequest, ListParticipantsResponse>newBuilder() 88 .setType(MethodDescriptor.MethodType.UNARY) 89 .setFullMethodName("google.cloud.dialogflow.v2.Participants/ListParticipants") 90 .setRequestMarshaller( 91 ProtoUtils.marshaller(ListParticipantsRequest.getDefaultInstance())) 92 .setResponseMarshaller( 93 ProtoUtils.marshaller(ListParticipantsResponse.getDefaultInstance())) 94 .build(); 95 96 private static final MethodDescriptor<UpdateParticipantRequest, Participant> 97 updateParticipantMethodDescriptor = 98 MethodDescriptor.<UpdateParticipantRequest, Participant>newBuilder() 99 .setType(MethodDescriptor.MethodType.UNARY) 100 .setFullMethodName("google.cloud.dialogflow.v2.Participants/UpdateParticipant") 101 .setRequestMarshaller( 102 ProtoUtils.marshaller(UpdateParticipantRequest.getDefaultInstance())) 103 .setResponseMarshaller(ProtoUtils.marshaller(Participant.getDefaultInstance())) 104 .build(); 105 106 private static final MethodDescriptor<AnalyzeContentRequest, AnalyzeContentResponse> 107 analyzeContentMethodDescriptor = 108 MethodDescriptor.<AnalyzeContentRequest, AnalyzeContentResponse>newBuilder() 109 .setType(MethodDescriptor.MethodType.UNARY) 110 .setFullMethodName("google.cloud.dialogflow.v2.Participants/AnalyzeContent") 111 .setRequestMarshaller( 112 ProtoUtils.marshaller(AnalyzeContentRequest.getDefaultInstance())) 113 .setResponseMarshaller( 114 ProtoUtils.marshaller(AnalyzeContentResponse.getDefaultInstance())) 115 .build(); 116 117 private static final MethodDescriptor< 118 StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> 119 streamingAnalyzeContentMethodDescriptor = 120 MethodDescriptor 121 .<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse>newBuilder() 122 .setType(MethodDescriptor.MethodType.BIDI_STREAMING) 123 .setFullMethodName("google.cloud.dialogflow.v2.Participants/StreamingAnalyzeContent") 124 .setRequestMarshaller( 125 ProtoUtils.marshaller(StreamingAnalyzeContentRequest.getDefaultInstance())) 126 .setResponseMarshaller( 127 ProtoUtils.marshaller(StreamingAnalyzeContentResponse.getDefaultInstance())) 128 .build(); 129 130 private static final MethodDescriptor<SuggestArticlesRequest, SuggestArticlesResponse> 131 suggestArticlesMethodDescriptor = 132 MethodDescriptor.<SuggestArticlesRequest, SuggestArticlesResponse>newBuilder() 133 .setType(MethodDescriptor.MethodType.UNARY) 134 .setFullMethodName("google.cloud.dialogflow.v2.Participants/SuggestArticles") 135 .setRequestMarshaller( 136 ProtoUtils.marshaller(SuggestArticlesRequest.getDefaultInstance())) 137 .setResponseMarshaller( 138 ProtoUtils.marshaller(SuggestArticlesResponse.getDefaultInstance())) 139 .build(); 140 141 private static final MethodDescriptor<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse> 142 suggestFaqAnswersMethodDescriptor = 143 MethodDescriptor.<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse>newBuilder() 144 .setType(MethodDescriptor.MethodType.UNARY) 145 .setFullMethodName("google.cloud.dialogflow.v2.Participants/SuggestFaqAnswers") 146 .setRequestMarshaller( 147 ProtoUtils.marshaller(SuggestFaqAnswersRequest.getDefaultInstance())) 148 .setResponseMarshaller( 149 ProtoUtils.marshaller(SuggestFaqAnswersResponse.getDefaultInstance())) 150 .build(); 151 152 private static final MethodDescriptor<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse> 153 suggestSmartRepliesMethodDescriptor = 154 MethodDescriptor.<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse>newBuilder() 155 .setType(MethodDescriptor.MethodType.UNARY) 156 .setFullMethodName("google.cloud.dialogflow.v2.Participants/SuggestSmartReplies") 157 .setRequestMarshaller( 158 ProtoUtils.marshaller(SuggestSmartRepliesRequest.getDefaultInstance())) 159 .setResponseMarshaller( 160 ProtoUtils.marshaller(SuggestSmartRepliesResponse.getDefaultInstance())) 161 .build(); 162 163 private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse> 164 listLocationsMethodDescriptor = 165 MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder() 166 .setType(MethodDescriptor.MethodType.UNARY) 167 .setFullMethodName("google.cloud.location.Locations/ListLocations") 168 .setRequestMarshaller( 169 ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) 170 .setResponseMarshaller( 171 ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) 172 .build(); 173 174 private static final MethodDescriptor<GetLocationRequest, Location> getLocationMethodDescriptor = 175 MethodDescriptor.<GetLocationRequest, Location>newBuilder() 176 .setType(MethodDescriptor.MethodType.UNARY) 177 .setFullMethodName("google.cloud.location.Locations/GetLocation") 178 .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) 179 .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) 180 .build(); 181 182 private final UnaryCallable<CreateParticipantRequest, Participant> createParticipantCallable; 183 private final UnaryCallable<GetParticipantRequest, Participant> getParticipantCallable; 184 private final UnaryCallable<ListParticipantsRequest, ListParticipantsResponse> 185 listParticipantsCallable; 186 private final UnaryCallable<ListParticipantsRequest, ListParticipantsPagedResponse> 187 listParticipantsPagedCallable; 188 private final UnaryCallable<UpdateParticipantRequest, Participant> updateParticipantCallable; 189 private final UnaryCallable<AnalyzeContentRequest, AnalyzeContentResponse> analyzeContentCallable; 190 private final BidiStreamingCallable< 191 StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> 192 streamingAnalyzeContentCallable; 193 private final UnaryCallable<SuggestArticlesRequest, SuggestArticlesResponse> 194 suggestArticlesCallable; 195 private final UnaryCallable<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse> 196 suggestFaqAnswersCallable; 197 private final UnaryCallable<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse> 198 suggestSmartRepliesCallable; 199 private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable; 200 private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> 201 listLocationsPagedCallable; 202 private final UnaryCallable<GetLocationRequest, Location> getLocationCallable; 203 204 private final BackgroundResource backgroundResources; 205 private final GrpcOperationsStub operationsStub; 206 private final GrpcStubCallableFactory callableFactory; 207 create(ParticipantsStubSettings settings)208 public static final GrpcParticipantsStub create(ParticipantsStubSettings settings) 209 throws IOException { 210 return new GrpcParticipantsStub(settings, ClientContext.create(settings)); 211 } 212 create(ClientContext clientContext)213 public static final GrpcParticipantsStub create(ClientContext clientContext) throws IOException { 214 return new GrpcParticipantsStub(ParticipantsStubSettings.newBuilder().build(), clientContext); 215 } 216 create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)217 public static final GrpcParticipantsStub create( 218 ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { 219 return new GrpcParticipantsStub( 220 ParticipantsStubSettings.newBuilder().build(), clientContext, callableFactory); 221 } 222 223 /** 224 * Constructs an instance of GrpcParticipantsStub, using the given settings. This is protected so 225 * that it is easy to make a subclass, but otherwise, the static factory methods should be 226 * preferred. 227 */ GrpcParticipantsStub(ParticipantsStubSettings settings, ClientContext clientContext)228 protected GrpcParticipantsStub(ParticipantsStubSettings settings, ClientContext clientContext) 229 throws IOException { 230 this(settings, clientContext, new GrpcParticipantsCallableFactory()); 231 } 232 233 /** 234 * Constructs an instance of GrpcParticipantsStub, using the given settings. This is protected so 235 * that it is easy to make a subclass, but otherwise, the static factory methods should be 236 * preferred. 237 */ GrpcParticipantsStub( ParticipantsStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)238 protected GrpcParticipantsStub( 239 ParticipantsStubSettings settings, 240 ClientContext clientContext, 241 GrpcStubCallableFactory callableFactory) 242 throws IOException { 243 this.callableFactory = callableFactory; 244 this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); 245 246 GrpcCallSettings<CreateParticipantRequest, Participant> createParticipantTransportSettings = 247 GrpcCallSettings.<CreateParticipantRequest, Participant>newBuilder() 248 .setMethodDescriptor(createParticipantMethodDescriptor) 249 .setParamsExtractor( 250 request -> { 251 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 252 params.put("parent", String.valueOf(request.getParent())); 253 return params.build(); 254 }) 255 .build(); 256 GrpcCallSettings<GetParticipantRequest, Participant> getParticipantTransportSettings = 257 GrpcCallSettings.<GetParticipantRequest, Participant>newBuilder() 258 .setMethodDescriptor(getParticipantMethodDescriptor) 259 .setParamsExtractor( 260 request -> { 261 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 262 params.put("name", String.valueOf(request.getName())); 263 return params.build(); 264 }) 265 .build(); 266 GrpcCallSettings<ListParticipantsRequest, ListParticipantsResponse> 267 listParticipantsTransportSettings = 268 GrpcCallSettings.<ListParticipantsRequest, ListParticipantsResponse>newBuilder() 269 .setMethodDescriptor(listParticipantsMethodDescriptor) 270 .setParamsExtractor( 271 request -> { 272 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 273 params.put("parent", String.valueOf(request.getParent())); 274 return params.build(); 275 }) 276 .build(); 277 GrpcCallSettings<UpdateParticipantRequest, Participant> updateParticipantTransportSettings = 278 GrpcCallSettings.<UpdateParticipantRequest, Participant>newBuilder() 279 .setMethodDescriptor(updateParticipantMethodDescriptor) 280 .setParamsExtractor( 281 request -> { 282 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 283 params.put( 284 "participant.name", String.valueOf(request.getParticipant().getName())); 285 return params.build(); 286 }) 287 .build(); 288 GrpcCallSettings<AnalyzeContentRequest, AnalyzeContentResponse> 289 analyzeContentTransportSettings = 290 GrpcCallSettings.<AnalyzeContentRequest, AnalyzeContentResponse>newBuilder() 291 .setMethodDescriptor(analyzeContentMethodDescriptor) 292 .setParamsExtractor( 293 request -> { 294 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 295 params.put("participant", String.valueOf(request.getParticipant())); 296 return params.build(); 297 }) 298 .build(); 299 GrpcCallSettings<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> 300 streamingAnalyzeContentTransportSettings = 301 GrpcCallSettings 302 .<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse>newBuilder() 303 .setMethodDescriptor(streamingAnalyzeContentMethodDescriptor) 304 .build(); 305 GrpcCallSettings<SuggestArticlesRequest, SuggestArticlesResponse> 306 suggestArticlesTransportSettings = 307 GrpcCallSettings.<SuggestArticlesRequest, SuggestArticlesResponse>newBuilder() 308 .setMethodDescriptor(suggestArticlesMethodDescriptor) 309 .setParamsExtractor( 310 request -> { 311 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 312 params.put("parent", String.valueOf(request.getParent())); 313 return params.build(); 314 }) 315 .build(); 316 GrpcCallSettings<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse> 317 suggestFaqAnswersTransportSettings = 318 GrpcCallSettings.<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse>newBuilder() 319 .setMethodDescriptor(suggestFaqAnswersMethodDescriptor) 320 .setParamsExtractor( 321 request -> { 322 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 323 params.put("parent", String.valueOf(request.getParent())); 324 return params.build(); 325 }) 326 .build(); 327 GrpcCallSettings<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse> 328 suggestSmartRepliesTransportSettings = 329 GrpcCallSettings.<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse>newBuilder() 330 .setMethodDescriptor(suggestSmartRepliesMethodDescriptor) 331 .setParamsExtractor( 332 request -> { 333 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 334 params.put("parent", String.valueOf(request.getParent())); 335 return params.build(); 336 }) 337 .build(); 338 GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings = 339 GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder() 340 .setMethodDescriptor(listLocationsMethodDescriptor) 341 .setParamsExtractor( 342 request -> { 343 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 344 params.put("name", String.valueOf(request.getName())); 345 return params.build(); 346 }) 347 .build(); 348 GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings = 349 GrpcCallSettings.<GetLocationRequest, Location>newBuilder() 350 .setMethodDescriptor(getLocationMethodDescriptor) 351 .setParamsExtractor( 352 request -> { 353 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 354 params.put("name", String.valueOf(request.getName())); 355 return params.build(); 356 }) 357 .build(); 358 359 this.createParticipantCallable = 360 callableFactory.createUnaryCallable( 361 createParticipantTransportSettings, 362 settings.createParticipantSettings(), 363 clientContext); 364 this.getParticipantCallable = 365 callableFactory.createUnaryCallable( 366 getParticipantTransportSettings, settings.getParticipantSettings(), clientContext); 367 this.listParticipantsCallable = 368 callableFactory.createUnaryCallable( 369 listParticipantsTransportSettings, settings.listParticipantsSettings(), clientContext); 370 this.listParticipantsPagedCallable = 371 callableFactory.createPagedCallable( 372 listParticipantsTransportSettings, settings.listParticipantsSettings(), clientContext); 373 this.updateParticipantCallable = 374 callableFactory.createUnaryCallable( 375 updateParticipantTransportSettings, 376 settings.updateParticipantSettings(), 377 clientContext); 378 this.analyzeContentCallable = 379 callableFactory.createUnaryCallable( 380 analyzeContentTransportSettings, settings.analyzeContentSettings(), clientContext); 381 this.streamingAnalyzeContentCallable = 382 callableFactory.createBidiStreamingCallable( 383 streamingAnalyzeContentTransportSettings, 384 settings.streamingAnalyzeContentSettings(), 385 clientContext); 386 this.suggestArticlesCallable = 387 callableFactory.createUnaryCallable( 388 suggestArticlesTransportSettings, settings.suggestArticlesSettings(), clientContext); 389 this.suggestFaqAnswersCallable = 390 callableFactory.createUnaryCallable( 391 suggestFaqAnswersTransportSettings, 392 settings.suggestFaqAnswersSettings(), 393 clientContext); 394 this.suggestSmartRepliesCallable = 395 callableFactory.createUnaryCallable( 396 suggestSmartRepliesTransportSettings, 397 settings.suggestSmartRepliesSettings(), 398 clientContext); 399 this.listLocationsCallable = 400 callableFactory.createUnaryCallable( 401 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 402 this.listLocationsPagedCallable = 403 callableFactory.createPagedCallable( 404 listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); 405 this.getLocationCallable = 406 callableFactory.createUnaryCallable( 407 getLocationTransportSettings, settings.getLocationSettings(), clientContext); 408 409 this.backgroundResources = 410 new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 411 } 412 getOperationsStub()413 public GrpcOperationsStub getOperationsStub() { 414 return operationsStub; 415 } 416 417 @Override createParticipantCallable()418 public UnaryCallable<CreateParticipantRequest, Participant> createParticipantCallable() { 419 return createParticipantCallable; 420 } 421 422 @Override getParticipantCallable()423 public UnaryCallable<GetParticipantRequest, Participant> getParticipantCallable() { 424 return getParticipantCallable; 425 } 426 427 @Override 428 public UnaryCallable<ListParticipantsRequest, ListParticipantsResponse> listParticipantsCallable()429 listParticipantsCallable() { 430 return listParticipantsCallable; 431 } 432 433 @Override 434 public UnaryCallable<ListParticipantsRequest, ListParticipantsPagedResponse> listParticipantsPagedCallable()435 listParticipantsPagedCallable() { 436 return listParticipantsPagedCallable; 437 } 438 439 @Override updateParticipantCallable()440 public UnaryCallable<UpdateParticipantRequest, Participant> updateParticipantCallable() { 441 return updateParticipantCallable; 442 } 443 444 @Override analyzeContentCallable()445 public UnaryCallable<AnalyzeContentRequest, AnalyzeContentResponse> analyzeContentCallable() { 446 return analyzeContentCallable; 447 } 448 449 @Override 450 public BidiStreamingCallable<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> streamingAnalyzeContentCallable()451 streamingAnalyzeContentCallable() { 452 return streamingAnalyzeContentCallable; 453 } 454 455 @Override suggestArticlesCallable()456 public UnaryCallable<SuggestArticlesRequest, SuggestArticlesResponse> suggestArticlesCallable() { 457 return suggestArticlesCallable; 458 } 459 460 @Override 461 public UnaryCallable<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse> suggestFaqAnswersCallable()462 suggestFaqAnswersCallable() { 463 return suggestFaqAnswersCallable; 464 } 465 466 @Override 467 public UnaryCallable<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse> suggestSmartRepliesCallable()468 suggestSmartRepliesCallable() { 469 return suggestSmartRepliesCallable; 470 } 471 472 @Override listLocationsCallable()473 public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { 474 return listLocationsCallable; 475 } 476 477 @Override 478 public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable()479 listLocationsPagedCallable() { 480 return listLocationsPagedCallable; 481 } 482 483 @Override getLocationCallable()484 public UnaryCallable<GetLocationRequest, Location> getLocationCallable() { 485 return getLocationCallable; 486 } 487 488 @Override close()489 public final void close() { 490 try { 491 backgroundResources.close(); 492 } catch (RuntimeException e) { 493 throw e; 494 } catch (Exception e) { 495 throw new IllegalStateException("Failed to close resource", e); 496 } 497 } 498 499 @Override shutdown()500 public void shutdown() { 501 backgroundResources.shutdown(); 502 } 503 504 @Override isShutdown()505 public boolean isShutdown() { 506 return backgroundResources.isShutdown(); 507 } 508 509 @Override isTerminated()510 public boolean isTerminated() { 511 return backgroundResources.isTerminated(); 512 } 513 514 @Override shutdownNow()515 public void shutdownNow() { 516 backgroundResources.shutdownNow(); 517 } 518 519 @Override awaitTermination(long duration, TimeUnit unit)520 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 521 return backgroundResources.awaitTermination(duration, unit); 522 } 523 } 524