Class Debugger2Client (1.28.0)

publicclass Debugger2ClientimplementsBackgroundResource

Service Description: The Debugger service provides the API that allows users to collect run-time information from a running application, without stopping or slowing it down and without modifying its state. An application may include one or more replicated processes performing the same work.

A debugged application is represented using the Debuggee concept. The Debugger service provides a way to query for available debuggees, but does not provide a way to create one. A debuggee is created using the Controller service, usually by running a debugger agent with the application.

The Debugger service enables the client to set one or more Breakpoints on a Debuggee and collect the results of the set Breakpoints.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
StringdebuggeeId="debuggeeId-1833285553";
Breakpointbreakpoint=Breakpoint.newBuilder().build();
StringclientVersion="clientVersion771880589";
SetBreakpointResponseresponse=
debugger2Client.setBreakpoint(debuggeeId,breakpoint,clientVersion);
}

Note: close() needs to be called on the Debugger2Client 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 Debugger2Settings 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
Debugger2Settingsdebugger2Settings=
Debugger2Settings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
Debugger2Clientdebugger2Client=Debugger2Client.create(debugger2Settings);

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
Debugger2Settingsdebugger2Settings=
Debugger2Settings.newBuilder().setEndpoint(myEndpoint).build();
Debugger2Clientdebugger2Client=Debugger2Client.create(debugger2Settings);

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
Debugger2Settingsdebugger2Settings=Debugger2Settings.newHttpJsonBuilder().build();
Debugger2Clientdebugger2Client=Debugger2Client.create(debugger2Settings);

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > Debugger2Client

Implements

BackgroundResource

Static Methods

create()

publicstaticfinalDebugger2Clientcreate()

Constructs an instance of Debugger2Client with default settings.

Returns
Type Description
Debugger2Client
Exceptions
Type Description
IOException

create(Debugger2Settings settings)

publicstaticfinalDebugger2Clientcreate(Debugger2Settingssettings)

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

create(Debugger2Stub stub)

publicstaticfinalDebugger2Clientcreate(Debugger2Stubstub)

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

Parameter
Name Description
stub Debugger2Stub
Returns
Type Description
Debugger2Client

Constructors

Debugger2Client(Debugger2Settings settings)

protectedDebugger2Client(Debugger2Settingssettings)

Constructs an instance of Debugger2Client, 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 Debugger2Settings

Debugger2Client(Debugger2Stub stub)

protectedDebugger2Client(Debugger2Stubstub)
Parameter
Name Description
stub Debugger2Stub

Methods

awaitTermination(long duration, TimeUnit unit)

publicbooleanawaitTermination(longduration,TimeUnitunit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

publicfinalvoidclose()

deleteBreakpoint(DeleteBreakpointRequest request)

publicfinalvoiddeleteBreakpoint(DeleteBreakpointRequestrequest)

Deletes the breakpoint from the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
DeleteBreakpointRequestrequest=
DeleteBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpointId("breakpointId570266860")
.setClientVersion("clientVersion771880589")
.build();
debugger2Client.deleteBreakpoint(request);
}
Parameter
Name Description
request DeleteBreakpointRequest

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

deleteBreakpoint(String debuggeeId, String breakpointId, String clientVersion)

publicfinalvoiddeleteBreakpoint(StringdebuggeeId,StringbreakpointId,StringclientVersion)

Deletes the breakpoint from the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
StringdebuggeeId="debuggeeId-1833285553";
StringbreakpointId="breakpointId570266860";
StringclientVersion="clientVersion771880589";
debugger2Client.deleteBreakpoint(debuggeeId,breakpointId,clientVersion);
}
Parameters
Name Description
debuggeeId String

Required. ID of the debuggee whose breakpoint to delete.

breakpointId String

Required. ID of the breakpoint to delete.

clientVersion String

Required. The client version making the call. Schema: domain/type/version (e.g., google.com/intellij/v1).

deleteBreakpointCallable()

publicfinalUnaryCallable<DeleteBreakpointRequest,Empty>deleteBreakpointCallable()

Deletes the breakpoint from the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
DeleteBreakpointRequestrequest=
DeleteBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpointId("breakpointId570266860")
.setClientVersion("clientVersion771880589")
.build();
ApiFuture<Empty>future=debugger2Client.deleteBreakpointCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description
UnaryCallable<DeleteBreakpointRequest,Empty>

getBreakpoint(GetBreakpointRequest request)

publicfinalGetBreakpointResponsegetBreakpoint(GetBreakpointRequestrequest)

Gets breakpoint information.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
GetBreakpointRequestrequest=
GetBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpointId("breakpointId570266860")
.setClientVersion("clientVersion771880589")
.build();
GetBreakpointResponseresponse=debugger2Client.getBreakpoint(request);
}
Parameter
Name Description
request GetBreakpointRequest

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

Returns
Type Description
GetBreakpointResponse

getBreakpoint(String debuggeeId, String breakpointId, String clientVersion)

publicfinalGetBreakpointResponsegetBreakpoint(StringdebuggeeId,StringbreakpointId,StringclientVersion)

Gets breakpoint information.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
StringdebuggeeId="debuggeeId-1833285553";
StringbreakpointId="breakpointId570266860";
StringclientVersion="clientVersion771880589";
GetBreakpointResponseresponse=
debugger2Client.getBreakpoint(debuggeeId,breakpointId,clientVersion);
}
Parameters
Name Description
debuggeeId String

Required. ID of the debuggee whose breakpoint to get.

breakpointId String

Required. ID of the breakpoint to get.

clientVersion String

Required. The client version making the call. Schema: domain/type/version (e.g., google.com/intellij/v1).

Returns
Type Description
GetBreakpointResponse

getBreakpointCallable()

publicfinalUnaryCallable<GetBreakpointRequest,GetBreakpointResponse>getBreakpointCallable()

Gets breakpoint information.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
GetBreakpointRequestrequest=
GetBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpointId("breakpointId570266860")
.setClientVersion("clientVersion771880589")
.build();
ApiFuture<GetBreakpointResponse>future=
debugger2Client.getBreakpointCallable().futureCall(request);
// Do something.
GetBreakpointResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetBreakpointRequest,GetBreakpointResponse>

getSettings()

publicfinalDebugger2SettingsgetSettings()
Returns
Type Description
Debugger2Settings

getStub()

publicDebugger2StubgetStub()
Returns
Type Description
Debugger2Stub

isShutdown()

publicbooleanisShutdown()
Returns
Type Description
boolean

isTerminated()

publicbooleanisTerminated()
Returns
Type Description
boolean

listBreakpoints(ListBreakpointsRequest request)

publicfinalListBreakpointsResponselistBreakpoints(ListBreakpointsRequestrequest)

Lists all breakpoints for the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
ListBreakpointsRequestrequest=
ListBreakpointsRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setIncludeAllUsers(true)
.setIncludeInactive(true)
.setAction(ListBreakpointsRequest.BreakpointActionValue.newBuilder().build())
.setStripResults(true)
.setWaitToken("waitToken-984229500")
.setClientVersion("clientVersion771880589")
.build();
ListBreakpointsResponseresponse=debugger2Client.listBreakpoints(request);
}
Parameter
Name Description
request ListBreakpointsRequest

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

Returns
Type Description
ListBreakpointsResponse

listBreakpoints(String debuggeeId, String clientVersion)

publicfinalListBreakpointsResponselistBreakpoints(StringdebuggeeId,StringclientVersion)

Lists all breakpoints for the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
StringdebuggeeId="debuggeeId-1833285553";
StringclientVersion="clientVersion771880589";
ListBreakpointsResponseresponse=debugger2Client.listBreakpoints(debuggeeId,clientVersion);
}
Parameters
Name Description
debuggeeId String

Required. ID of the debuggee whose breakpoints to list.

clientVersion String

Required. The client version making the call. Schema: domain/type/version (e.g., google.com/intellij/v1).

Returns
Type Description
ListBreakpointsResponse

listBreakpointsCallable()

publicfinalUnaryCallable<ListBreakpointsRequest,ListBreakpointsResponse>listBreakpointsCallable()

Lists all breakpoints for the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
ListBreakpointsRequestrequest=
ListBreakpointsRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setIncludeAllUsers(true)
.setIncludeInactive(true)
.setAction(ListBreakpointsRequest.BreakpointActionValue.newBuilder().build())
.setStripResults(true)
.setWaitToken("waitToken-984229500")
.setClientVersion("clientVersion771880589")
.build();
ApiFuture<ListBreakpointsResponse>future=
debugger2Client.listBreakpointsCallable().futureCall(request);
// Do something.
ListBreakpointsResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<ListBreakpointsRequest,ListBreakpointsResponse>

listDebuggees(ListDebuggeesRequest request)

publicfinalListDebuggeesResponselistDebuggees(ListDebuggeesRequestrequest)

Lists all the debuggees that the user has access to.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
ListDebuggeesRequestrequest=
ListDebuggeesRequest.newBuilder()
.setProject("project-309310695")
.setIncludeInactive(true)
.setClientVersion("clientVersion771880589")
.build();
ListDebuggeesResponseresponse=debugger2Client.listDebuggees(request);
}
Parameter
Name Description
request ListDebuggeesRequest

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

Returns
Type Description
ListDebuggeesResponse

listDebuggees(String project, String clientVersion)

publicfinalListDebuggeesResponselistDebuggees(Stringproject,StringclientVersion)

Lists all the debuggees that the user has access to.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
Stringproject="project-309310695";
StringclientVersion="clientVersion771880589";
ListDebuggeesResponseresponse=debugger2Client.listDebuggees(project,clientVersion);
}
Parameters
Name Description
project String

Required. Project number of a Google Cloud project whose debuggees to list.

clientVersion String

Required. The client version making the call. Schema: domain/type/version (e.g., google.com/intellij/v1).

Returns
Type Description
ListDebuggeesResponse

listDebuggeesCallable()

publicfinalUnaryCallable<ListDebuggeesRequest,ListDebuggeesResponse>listDebuggeesCallable()

Lists all the debuggees that the user has access to.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
ListDebuggeesRequestrequest=
ListDebuggeesRequest.newBuilder()
.setProject("project-309310695")
.setIncludeInactive(true)
.setClientVersion("clientVersion771880589")
.build();
ApiFuture<ListDebuggeesResponse>future=
debugger2Client.listDebuggeesCallable().futureCall(request);
// Do something.
ListDebuggeesResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<ListDebuggeesRequest,ListDebuggeesResponse>

setBreakpoint(SetBreakpointRequest request)

publicfinalSetBreakpointResponsesetBreakpoint(SetBreakpointRequestrequest)

Sets the breakpoint to the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
SetBreakpointRequestrequest=
SetBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpoint(Breakpoint.newBuilder().build())
.setClientVersion("clientVersion771880589")
.build();
SetBreakpointResponseresponse=debugger2Client.setBreakpoint(request);
}
Parameter
Name Description
request SetBreakpointRequest

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

Returns
Type Description
SetBreakpointResponse

setBreakpoint(String debuggeeId, Breakpoint breakpoint, String clientVersion)

publicfinalSetBreakpointResponsesetBreakpoint(StringdebuggeeId,Breakpointbreakpoint,StringclientVersion)

Sets the breakpoint to the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
StringdebuggeeId="debuggeeId-1833285553";
Breakpointbreakpoint=Breakpoint.newBuilder().build();
StringclientVersion="clientVersion771880589";
SetBreakpointResponseresponse=
debugger2Client.setBreakpoint(debuggeeId,breakpoint,clientVersion);
}
Parameters
Name Description
debuggeeId String

Required. ID of the debuggee where the breakpoint is to be set.

breakpoint Breakpoint

Required. Breakpoint specification to set. The field location of the breakpoint must be set.

clientVersion String

Required. The client version making the call. Schema: domain/type/version (e.g., google.com/intellij/v1).

Returns
Type Description
SetBreakpointResponse

setBreakpointCallable()

publicfinalUnaryCallable<SetBreakpointRequest,SetBreakpointResponse>setBreakpointCallable()

Sets the breakpoint to the debuggee.

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(Debugger2Clientdebugger2Client=Debugger2Client.create()){
SetBreakpointRequestrequest=
SetBreakpointRequest.newBuilder()
.setDebuggeeId("debuggeeId-1833285553")
.setBreakpoint(Breakpoint.newBuilder().build())
.setClientVersion("clientVersion771880589")
.build();
ApiFuture<SetBreakpointResponse>future=
debugger2Client.setBreakpointCallable().futureCall(request);
// Do something.
SetBreakpointResponseresponse=future.get();
}
Returns
Type Description
UnaryCallable<SetBreakpointRequest,SetBreakpointResponse>

shutdown()

publicvoidshutdown()

shutdownNow()

publicvoidshutdownNow()

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.