@Generated(value="by gapic-generator-java") public class Controller2Client extends Object implements com.google.api.gax.core.BackgroundResource
The debugger agents register with the Controller to identify the application being debugged, the Debuggee. All agents that register with the same data, represent the same Debuggee, and are assigned the same `debuggee_id`.
The debugger agents call the Controller to retrieve the list of active Breakpoints. Agents with the same `debuggee_id` get the same breakpoints list. An agent that can fulfill the breakpoint request updates the Controller with the breakpoint result. The controller selects the first result received and discards the rest of the results. Agents that poll again for active breakpoints will no longer have the completed breakpoint in the list and should remove that breakpoint from their attached process.
The Controller service does not provide a way to retrieve the results of a completed breakpoint. This functionality is available using the Debugger service.
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 (Controller2Client controller2Client = Controller2Client.create()) {
Debuggee debuggee = Debuggee.newBuilder().build();
RegisterDebuggeeResponse response = controller2Client.registerDebuggee(debuggee);
}
Note: close() needs to be called on the Controller2Client 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 |
|---|---|---|
RegisterDebuggee |
Registers the debuggee with the controller service. All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method. This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListActiveBreakpoints |
Returns the list of all active breakpoints for the debuggee. The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics. This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateActiveBreakpoint |
Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 Controller2Settings 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
Controller2Settings controller2Settings =
Controller2Settings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
Controller2Client controller2Client = Controller2Client.create(controller2Settings);
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
Controller2Settings controller2Settings =
Controller2Settings.newBuilder().setEndpoint(myEndpoint).build();
Controller2Client controller2Client = Controller2Client.create(controller2Settings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
Controller2Settings controller2Settings = Controller2Settings.newHttpJsonBuilder().build();
Controller2Client controller2Client = Controller2Client.create(controller2Settings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier | Constructor and Description |
|---|---|
protected |
Controller2Client(Controller2Settings settings)
Constructs an instance of Controller2Client, using the given settings.
|
protected |
Controller2Client(Controller2Stub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static Controller2Client |
create()
Constructs an instance of Controller2Client with default settings.
|
static Controller2Client |
create(Controller2Settings settings)
Constructs an instance of Controller2Client, using the given settings.
|
static Controller2Client |
create(Controller2Stub stub)
Constructs an instance of Controller2Client, using the given stub for making calls.
|
Controller2Settings |
getSettings() |
Controller2Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ListActiveBreakpointsResponse |
listActiveBreakpoints(ListActiveBreakpointsRequest request)
Returns the list of all active breakpoints for the debuggee.
|
ListActiveBreakpointsResponse |
listActiveBreakpoints(String debuggeeId)
Returns the list of all active breakpoints for the debuggee.
|
com.google.api.gax.rpc.UnaryCallable<ListActiveBreakpointsRequest,ListActiveBreakpointsResponse> |
listActiveBreakpointsCallable()
Returns the list of all active breakpoints for the debuggee.
|
RegisterDebuggeeResponse |
registerDebuggee(Debuggee debuggee)
Registers the debuggee with the controller service.
|
RegisterDebuggeeResponse |
registerDebuggee(RegisterDebuggeeRequest request)
Registers the debuggee with the controller service.
|
com.google.api.gax.rpc.UnaryCallable<RegisterDebuggeeRequest,RegisterDebuggeeResponse> |
registerDebuggeeCallable()
Registers the debuggee with the controller service.
|
void |
shutdown() |
void |
shutdownNow() |
UpdateActiveBreakpointResponse |
updateActiveBreakpoint(String debuggeeId,
Breakpoint breakpoint)
Updates the breakpoint state or mutable fields.
|
UpdateActiveBreakpointResponse |
updateActiveBreakpoint(UpdateActiveBreakpointRequest request)
Updates the breakpoint state or mutable fields.
|
com.google.api.gax.rpc.UnaryCallable<UpdateActiveBreakpointRequest,UpdateActiveBreakpointResponse> |
updateActiveBreakpointCallable()
Updates the breakpoint state or mutable fields.
|
protected Controller2Client(Controller2Settings settings) throws IOException
IOExceptionprotected Controller2Client(Controller2Stub stub)
public static final Controller2Client create() throws IOException
IOExceptionpublic static final Controller2Client create(Controller2Settings settings) throws IOException
IOExceptionpublic static final Controller2Client create(Controller2Stub stub)
public final Controller2Settings getSettings()
public Controller2Stub getStub()
public final RegisterDebuggeeResponse registerDebuggee(Debuggee debuggee)
All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.
This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.
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 (Controller2Client controller2Client = Controller2Client.create()) {
Debuggee debuggee = Debuggee.newBuilder().build();
RegisterDebuggeeResponse response = controller2Client.registerDebuggee(debuggee);
}
debuggee - Required. Debuggee information to register. The fields `project`, `uniquifier`,
`description` and `agent_version` of the debuggee must be set.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RegisterDebuggeeResponse registerDebuggee(RegisterDebuggeeRequest request)
All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.
This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.
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 (Controller2Client controller2Client = Controller2Client.create()) {
RegisterDebuggeeRequest request =
RegisterDebuggeeRequest.newBuilder().setDebuggee(Debuggee.newBuilder().build()).build();
RegisterDebuggeeResponse response = controller2Client.registerDebuggee(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RegisterDebuggeeRequest,RegisterDebuggeeResponse> registerDebuggeeCallable()
All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.
This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.
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 (Controller2Client controller2Client = Controller2Client.create()) {
RegisterDebuggeeRequest request =
RegisterDebuggeeRequest.newBuilder().setDebuggee(Debuggee.newBuilder().build()).build();
ApiFuture<RegisterDebuggeeResponse> future =
controller2Client.registerDebuggeeCallable().futureCall(request);
// Do something.
RegisterDebuggeeResponse response = future.get();
}
public final ListActiveBreakpointsResponse listActiveBreakpoints(String debuggeeId)
The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.
This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.
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 (Controller2Client controller2Client = Controller2Client.create()) {
String debuggeeId = "debuggeeId-1833285553";
ListActiveBreakpointsResponse response = controller2Client.listActiveBreakpoints(debuggeeId);
}
debuggeeId - Required. Identifies the debuggee.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ListActiveBreakpointsResponse listActiveBreakpoints(ListActiveBreakpointsRequest request)
The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.
This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.
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 (Controller2Client controller2Client = Controller2Client.create()) {
ListActiveBreakpointsRequest request =
ListActiveBreakpointsRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setWaitToken("waitToken-984229500")
.setSuccessOnTimeout(true)
.build();
ListActiveBreakpointsResponse response = controller2Client.listActiveBreakpoints(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListActiveBreakpointsRequest,ListActiveBreakpointsResponse> listActiveBreakpointsCallable()
The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.
This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.
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 (Controller2Client controller2Client = Controller2Client.create()) {
ListActiveBreakpointsRequest request =
ListActiveBreakpointsRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setWaitToken("waitToken-984229500")
.setSuccessOnTimeout(true)
.build();
ApiFuture<ListActiveBreakpointsResponse> future =
controller2Client.listActiveBreakpointsCallable().futureCall(request);
// Do something.
ListActiveBreakpointsResponse response = future.get();
}
public final UpdateActiveBreakpointResponse updateActiveBreakpoint(String debuggeeId, Breakpoint breakpoint)
Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.
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 (Controller2Client controller2Client = Controller2Client.create()) {
String debuggeeId = "debuggeeId-1833285553";
Breakpoint breakpoint = Breakpoint.newBuilder().build();
UpdateActiveBreakpointResponse response =
controller2Client.updateActiveBreakpoint(debuggeeId, breakpoint);
}
debuggeeId - Required. Identifies the debuggee being debugged.breakpoint - Required. Updated breakpoint information. The field `id` must be set. The
agent must echo all Breakpoint specification fields in the update.com.google.api.gax.rpc.ApiException - if the remote call failspublic final UpdateActiveBreakpointResponse updateActiveBreakpoint(UpdateActiveBreakpointRequest request)
Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.
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 (Controller2Client controller2Client = Controller2Client.create()) {
UpdateActiveBreakpointRequest request =
UpdateActiveBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpoint(Breakpoint.newBuilder().build())
.build();
UpdateActiveBreakpointResponse response = controller2Client.updateActiveBreakpoint(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateActiveBreakpointRequest,UpdateActiveBreakpointResponse> updateActiveBreakpointCallable()
Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.
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 (Controller2Client controller2Client = Controller2Client.create()) {
UpdateActiveBreakpointRequest request =
UpdateActiveBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpoint(Breakpoint.newBuilder().build())
.build();
ApiFuture<UpdateActiveBreakpointResponse> future =
controller2Client.updateActiveBreakpointCallable().futureCall(request);
// Do something.
UpdateActiveBreakpointResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.