Class Controller2Client (1.32.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().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns 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.

Inheritance

java.lang.Object > Controller2Client

Static Methods

create()

public static final Controller2Client create()

Constructs an instance of Controller2Client with default settings.

Returns
TypeDescription
Controller2Client
Exceptions
TypeDescription
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
NameDescription
settingsController2Settings
Returns
TypeDescription
Controller2Client
Exceptions
TypeDescription
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
NameDescription
stubController2Stub
Returns
TypeDescription
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
NameDescription
settingsController2Settings

Controller2Client(Controller2Stub stub)

protected Controller2Client(Controller2Stub stub)
Parameter
NameDescription
stubController2Stub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

getSettings()

public final Controller2Settings getSettings()
Returns
TypeDescription
Controller2Settings

getStub()

public Controller2Stub getStub()
Returns
TypeDescription
Controller2Stub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
requestListActiveBreakpointsRequest

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

Returns
TypeDescription
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
NameDescription
debuggeeIdString

Required. Identifies the debuggee.

Returns
TypeDescription
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
TypeDescription
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
NameDescription
debuggeeDebuggee

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

Returns
TypeDescription
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
NameDescription
requestRegisterDebuggeeRequest

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

Returns
TypeDescription
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
TypeDescription
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
NameDescription
requestUpdateActiveBreakpointRequest

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

Returns
TypeDescription
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
NameDescription
debuggeeIdString

Required. Identifies the debuggee being debugged.

breakpointBreakpoint

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<UpdateActiveBreakpointRequest,UpdateActiveBreakpointResponse>