# Class SpannerExecutorProxyClient (6.118.0)

6.118.0 (latest) 6.116.0 6.111.1 6.108.0 6.107.0 6.103.0 6.102.1 6.101.1 6.100.0 6.99.0 6.98.1 6.97.1 6.96.1 6.95.1 6.94.0 6.93.0 6.89.0 6.88.0 6.87.0 6.86.0 6.85.0 6.83.0 6.82.0 6.80.1 6.79.0 6.77.0 6.74.1 6.72.0 6.71.0 6.69.0 6.68.0 6.66.0 6.65.1 6.62.0 6.60.0 6.58.0 6.57.0 6.56.0 6.55.0 6.54.0 6.53.0 6.52.1 6.51.0 6.50.1 6.49.0 6.25.1 6.24.0 6.23.4 6.22.0 6.21.2 6.20.0 6.19.1 6.18.0 6.17.4 6.14.1

|---|---|
| [GitHub Repository](https://github.com/googleapis/google-cloud-java/tree/main/java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/executor/v1/SpannerExecutorProxyClient.java) | [Product Reference](https://cloud.google.com/spanner/docs/) |

Service Description: Service that executes SpannerActions asynchronously.

This class provides the ability to make remote calls to the backing service through method
calls that map to API methods. Sample code to get started:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (SpannerExecutorProxyClient spannerExecutorProxyClient =
         SpannerExecutorProxyClient.create()) {
       BidiStream<SpannerAsyncActionRequest, SpannerAsyncActionResponse> bidiStream =
           spannerExecutorProxyClient.executeActionAsyncCallable().call();
       SpannerAsyncActionRequest request =
           SpannerAsyncActionRequest.newBuilder()
               .setActionId(198295492)
               .setAction(SpannerAction.newBuilder().build())
               .build();
       bidiStream.send(request);
       for (SpannerAsyncActionResponse response : bidiStream) {
         // Do something when a response is received.
       }
     }
     
Note: close() needs to be called on the SpannerExecutorProxyClient object to clean up
resources such as threads. In the example above, try-with-resources is used, which automatically
calls close().

| Method | Description | Method Variants |
|---|---|---|
| ExecuteActionAsync | ExecuteActionAsync is a streaming call that starts executing a new Spanner action. For each request, the server will reply with one or more responses, but only the last response will contain status in the outcome. Responses can be matched to requests by action_id. It is allowed to have multiple actions in flight--in that case, actions are be executed in parallel. | Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - executeActionAsyncCallable() |
[Methods]

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with
these names, this class includes a format method for each type of name, and additionally a parse
method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of SpannerExecutorProxySettings
to create(). For example:

To customize credentials:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     SpannerExecutorProxySettings spannerExecutorProxySettings =
         SpannerExecutorProxySettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     SpannerExecutorProxyClient spannerExecutorProxyClient =
         SpannerExecutorProxyClient.create(spannerExecutorProxySettings);
     
To customize the endpoint:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     SpannerExecutorProxySettings spannerExecutorProxySettings =
         SpannerExecutorProxySettings.newBuilder().setEndpoint(myEndpoint).build();
     SpannerExecutorProxyClient spannerExecutorProxyClient =
         SpannerExecutorProxyClient.create(spannerExecutorProxySettings);
     
Please refer to the GitHub repository's samples for more quickstart code snippets.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> SpannerExecutorProxyClient

## Static Methods

### create()

    public static final SpannerExecutorProxyClient create()

Constructs an instance of SpannerExecutorProxyClient with default settings.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxyClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(SpannerExecutorProxySettings settings)

    public static final SpannerExecutorProxyClient create(SpannerExecutorProxySettings settings)

Constructs an instance of SpannerExecutorProxyClient, using the given settings. The channels
are created based on the settings passed in, or defaults for any settings that are not set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxySettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxyClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(SpannerExecutorProxyStub stub)

    public static final SpannerExecutorProxyClient create(SpannerExecutorProxyStub stub)

Constructs an instance of SpannerExecutorProxyClient, using the given stub for making calls.
This is for advanced usage - prefer using create(SpannerExecutorProxySettings).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.stub.SpannerExecutorProxyStub` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxyClient` |   |

## Constructors

### SpannerExecutorProxyClient(SpannerExecutorProxySettings settings)

    protected SpannerExecutorProxyClient(SpannerExecutorProxySettings settings)

Constructs an instance of SpannerExecutorProxyClient, using the given settings. This is
protected so that it is easy to make a subclass, but otherwise, the static factory methods
should be preferred.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxySettings` |

### SpannerExecutorProxyClient(SpannerExecutorProxyStub stub)

    protected SpannerExecutorProxyClient(SpannerExecutorProxyStub stub)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.stub.SpannerExecutorProxyStub` |

## Methods

### awaitTermination(long duration, TimeUnit unit)

    public boolean awaitTermination(long duration, TimeUnit unit)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `duration` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `unit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html` |   |

### close()

    public final void close()

### executeActionAsyncCallable()

    public final BidiStreamingCallable<SpannerAsyncActionRequest,SpannerAsyncActionResponse> executeActionAsyncCallable()

ExecuteActionAsync is a streaming call that starts executing a new Spanner action.

For each request, the server will reply with one or more responses, but only the last
response will contain status in the outcome.

Responses can be matched to requests by action_id. It is allowed to have multiple actions in
flight--in that case, actions are be executed in parallel.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (SpannerExecutorProxyClient spannerExecutorProxyClient =
         SpannerExecutorProxyClient.create()) {
       BidiStream<SpannerAsyncActionRequest, SpannerAsyncActionResponse> bidiStream =
           spannerExecutorProxyClient.executeActionAsyncCallable().call();
       SpannerAsyncActionRequest request =
           SpannerAsyncActionRequest.newBuilder()
               .setActionId(198295492)
               .setAction(SpannerAction.newBuilder().build())
               .build();
       bidiStream.send(request);
       for (SpannerAsyncActionResponse response : bidiStream) {
         // Do something when a response is received.
       }
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.BidiStreamingCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.executor.v1.SpannerAsyncActionRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.executor.v1.SpannerAsyncActionResponse>` |   |

### getSettings()

    public final SpannerExecutorProxySettings getSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.SpannerExecutorProxySettings` |   |

### getStub()

    public SpannerExecutorProxyStub getStub()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.executor.v1.stub.SpannerExecutorProxyStub` |   |

### isShutdown()

    public boolean isShutdown()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isTerminated()

    public boolean isTerminated()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### shutdown()

    public void shutdown()

### shutdownNow()

    public void shutdownNow()