Package 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
Modifier and TypeMethodDescriptionvoidgetRequestThreads(E environment) Returns a list of all threads which are currently running requests.voidlog(E environment, ApiProxy.LogRecord record) Future<byte[]>makeAsyncCall(E environment, String packageName, String methodName, byte[] request, ApiProxy.ApiConfig apiConfig) Make an asynchronous call to the specified method in the specified API package.byte[]makeSyncCall(E environment, String packageName, String methodName, byte[] request) Make a synchronous call to the specified method in the specified API package.
-
Method Details
-
makeSyncCall
Make a synchronous call to the specified method in the specified API package.Note: if you have not installed a
Delegateand calledsetEnvironmentForCurrentThreadin this thread before calling this method, it will act like no API calls are available (i.e. always throwCallNotFoundException).- 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.
-
makeAsyncCall
Future<byte[]> makeAsyncCall(E environment, String packageName, 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
Delegateand calledsetEnvironmentForCurrentThreadin this thread before calling this method, it will act like no API calls are available (i.e. always throwCallNotFoundException).- 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
Futurethat will resolve to a byte array containing the serialized form of the response protocol buffer on success, or throw one of the exceptions documented formakeSyncCall(Environment, String, String, byte[])on failure.
-
log
-
flushLogs
-
getRequestThreads
Returns a list of all threads which are currently running requests.
-