Class Controller2Client (1.48.0)

GitHub RepositoryProduct Reference

Service Description: The Controller service provides the API for orchestrating a collection of debugger agents to perform debugging tasks. These agents are each attached to a process of an application which may include one or more replicas.

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().

Methods
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.

  • registerDebuggee(RegisterDebuggeeRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • registerDebuggee(Debuggee debuggee)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • registerDebuggeeCallable()

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.

  • listActiveBreakpoints(ListActiveBreakpointsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listActiveBreakpoints(String debuggeeId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listActiveBreakpointsCallable()

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.

  • updateActiveBreakpoint(UpdateActiveBreakpointRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateActiveBreakpoint(String debuggeeId, Breakpoint breakpoint)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateActiveBreakpointCallable()

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.

Inheritance

java.lang.Object > Controller2Client

Static Methods

create()

public static final Controller2Client create()

Constructs an instance of Controller2Client with default settings.

Returns
Type Description
Controller2Client
Exceptions
Type Description
IOException

create(Controller2Settings settings)

public static final Controller2Client create(Controller2Settings settings)

Constructs an instance of Controller2Client, 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 Controller2Settings
Returns
Type Description
Controller2Client
Exceptions
Type Description
IOException

create(Controller2Stub stub)

public static final Controller2Client create(Controller2Stub stub)

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

Parameter
Name Description
stub Controller2Stub
Returns
Type Description
Controller2Client

Constructors

Controller2Client(Controller2Settings settings)

protected Controller2Client(Controller2Settings settings)

Constructs an instance of Controller2Client, 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 Controller2Settings

Controller2Client(Controller2Stub stub)

protected Controller2Client(Controller2Stub stub)
Parameter
Name Description
stub Controller2Stub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

getSettings()

public final Controller2Settings getSettings()
Returns
Type Description
Controller2Settings

getStub()

public Controller2Stub getStub()
Returns
Type Description
Controller2Stub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listActiveBreakpoints(ListActiveBreakpointsRequest request)

public final ListActiveBreakpointsResponse listActiveBreakpoints(ListActiveBreakpointsRequest request)

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.

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);
 }
 
Parameter
Name Description
request ListActiveBreakpointsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ListActiveBreakpointsResponse

listActiveBreakpoints(String debuggeeId)

public final ListActiveBreakpointsResponse listActiveBreakpoints(String debuggeeId)

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.

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);
 }
 
Parameter
Name Description
debuggeeId String

Required. Identifies the debuggee.

Returns
Type Description
ListActiveBreakpointsResponse

listActiveBreakpointsCallable()

public final UnaryCallable<ListActiveBreakpointsRequest,ListActiveBreakpointsResponse> listActiveBreakpointsCallable()

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.

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();
 }
 
Returns
Type Description
UnaryCallable<ListActiveBreakpointsRequest,ListActiveBreakpointsResponse>

registerDebuggee(Debuggee debuggee)

public final RegisterDebuggeeResponse registerDebuggee(Debuggee debuggee)

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.

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);
 }
 
Parameter
Name Description
debuggee Debuggee

Required. Debuggee information to register. The fields project, uniquifier, description and agent_version of the debuggee must be set.

Returns
Type Description
RegisterDebuggeeResponse

registerDebuggee(RegisterDebuggeeRequest request)

public final RegisterDebuggeeResponse registerDebuggee(RegisterDebuggeeRequest request)

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.

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);
 }
 
Parameter
Name Description
request RegisterDebuggeeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RegisterDebuggeeResponse

registerDebuggeeCallable()

public final UnaryCallable<RegisterDebuggeeRequest,RegisterDebuggeeResponse> registerDebuggeeCallable()

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.

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();
 }
 
Returns
Type Description
UnaryCallable<RegisterDebuggeeRequest,RegisterDebuggeeResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateActiveBreakpoint(UpdateActiveBreakpointRequest request)

public final UpdateActiveBreakpointResponse updateActiveBreakpoint(UpdateActiveBreakpointRequest request)

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.

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);
 }
 
Parameter
Name Description
request UpdateActiveBreakpointRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
UpdateActiveBreakpointResponse

updateActiveBreakpoint(String debuggeeId, Breakpoint breakpoint)

public final UpdateActiveBreakpointResponse updateActiveBreakpoint(String debuggeeId, Breakpoint breakpoint)

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.

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);
 }
 
Parameters
Name Description
debuggeeId String

Required. Identifies the debuggee being debugged.

breakpoint Breakpoint

Required. Updated breakpoint information. The field id must be set. The agent must echo all Breakpoint specification fields in the update.

Returns
Type Description
UpdateActiveBreakpointResponse

updateActiveBreakpointCallable()

public final UnaryCallable<UpdateActiveBreakpointRequest,UpdateActiveBreakpointResponse> updateActiveBreakpointCallable()

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.

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();
 }
 
Returns
Type Description
UnaryCallable<UpdateActiveBreakpointRequest,UpdateActiveBreakpointResponse>