ApiProxy.Delegate (Google App Engine API for Java)

com.google.apphosting.api

Interface ApiProxy.Delegate<E extends ApiProxy.Environment>

  • Type Parameters:
    E - The concrete class implementing Environment that this Delegate expects to receive.
    Enclosing class:
    ApiProxy


    public static interface ApiProxy.Delegate<E extends ApiProxy.Environment>
    This interface can be used to provide a class that actually implements API calls.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void flushLogs(E environment) 
      java.util.List<java.lang.Thread> getRequestThreads(E environment)
      Returns a list of all threads which are currently running requests.
      void log(E environment, ApiProxy.LogRecord record) 
      java.util.concurrent.Future<byte[]> makeAsyncCall(E environment, java.lang.String packageName, java.lang.String methodName, byte[] request, ApiProxy.ApiConfig apiConfig)
      Make an asynchronous call to the specified method in the specified API package.
      byte[] makeSyncCall(E environment, java.lang.String packageName, java.lang.String methodName, byte[] request)
      Make a synchronous call to the specified method in the specified API package.
    • Method Detail

      • makeSyncCall

        byte[] makeSyncCall(E environment,
                            java.lang.String packageName,
                            java.lang.String methodName,
                            byte[] request)
                     throws ApiProxy.ApiProxyException
        Make a synchronous call to the specified method in the specified API package.

        Note: if you have not installed a Delegate and called setEnvironmentForCurrentThread in this thread before calling this method, it will act like no API calls are available (i.e. always throw CallNotFoundException).

        Parameters:
        environment - the current request environment.
        packageName - the name of the API package.
        methodName - the name of the method within the API package.
        request - a byte array containing the serialized form of the request protocol buffer.
        Returns:
        a byte array containing the serialized form of the response protocol buffer.
        Throws:
        ApiProxy.ApplicationException - For any error that is the application's fault.
        ApiProxy.RPCFailedException - If we could not connect to a backend service.
        ApiProxy.CallNotFoundException - If the specified method does not exist.
        ApiProxy.ArgumentException - If the request could not be parsed.
        DeadlineExceededException - If the request took too long.
        ApiProxy.CancelledException - If the request was explicitly cancelled.
        ApiProxy.UnknownException - If any other error occurred.
        ApiProxy.ApiProxyException
      • makeAsyncCall

        java.util.concurrent.Future<byte[]> makeAsyncCall(E environment,
                                                          java.lang.String packageName,
                                                          java.lang.String methodName,
                                                          byte[] request,
                                                          ApiProxy.ApiConfig apiConfig)
        Make an asynchronous call to the specified method in the specified API package.

        Note: if you have not installed a Delegate and called setEnvironmentForCurrentThread in this thread before calling this method, it will act like no API calls are available (i.e. always throw CallNotFoundException).

        Parameters:
        environment - the current request environment.
        packageName - the name of the API package.
        methodName - the name of the method within the API package.
        request - a byte array containing the serialized form of the request protocol buffer.
        apiConfig - that specifies API-specific configuration parameters.
        Returns:
        a Future that will resolve to a byte array containing the serialized form of the response protocol buffer on success, or throw one of the exceptions documented for #makeSyncCall(Environment, String, String, byte[]) on failure.
      • flushLogs

        void flushLogs(E environment)
      • getRequestThreads

        java.util.List<java.lang.Thread> getRequestThreads(E environment)
        Returns a list of all threads which are currently running requests.