Class Primer
- java.lang.Object
-
- com.google.ads.googleads.lib.catalog.Primer
-
- Direct Known Subclasses:
DefaultPrimer
@Beta public abstract class Primer extends java.lang.ObjectPerforms startup performance optimizations to avoid cold-start of clients. Disabled by default. To enable, set the system property defined by ENABLE_PRIMER_SYSTEM_PROPERTY=true.
-
-
Constructor Summary
Constructors Constructor Description Primer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<Primer>getInstance()Returns an instance of the primer, if enabled.static booleanisEnabled()Checks if the primer should be enabled.abstract voidprimeAllVersionsAsync()Primes the classes required byGoogleAdsAllVersionsstatic voidprimeBasicsIfEnabled()Primes any components that can be run without additional state (e.g.abstract voidprimeCredentialsAsync(com.google.auth.Credentials credentials)Primes the credentials, e.g.abstract voidprimeGrpcAsync()Primes the gRPC layer asynchronously.abstract voidprimeProtobufAsync()Primes the protobuf layer asynchronously.
-
-
-
Method Detail
-
getInstance
public static java.util.Optional<Primer> getInstance()
Returns an instance of the primer, if enabled. Otherwise, empty.
-
isEnabled
public static boolean isEnabled()
Checks if the primer should be enabled. This can be used to avoid initializing the primer.
-
primeBasicsIfEnabled
public static void primeBasicsIfEnabled()
Primes any components that can be run without additional state (e.g. credentials).
-
primeGrpcAsync
public abstract void primeGrpcAsync()
Primes the gRPC layer asynchronously.
-
primeProtobufAsync
public abstract void primeProtobufAsync()
Primes the protobuf layer asynchronously.
-
primeAllVersionsAsync
public abstract void primeAllVersionsAsync()
Primes the classes required byGoogleAdsAllVersions
-
primeCredentialsAsync
public abstract void primeCredentialsAsync(com.google.auth.Credentials credentials)
Primes the credentials, e.g. by preemptively loading an access token.- Parameters:
credentials- the credentials to prime.
-
-