Class Primer

  • Direct Known Subclasses:
    DefaultPrimer

    @Beta
    public abstract class Primer
    extends java.lang.Object
    Performs 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 Detail

      • Primer

        public Primer()
    • 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 by GoogleAdsAllVersions
      • 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.