E
- The concrete class implementing Environment that this
Delegate expects to receive.public static interface ApiProxy.Delegate<E extends ApiProxy.Environment>
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.
|
byte[] makeSyncCall(E environment, java.lang.String packageName, java.lang.String methodName, byte[] request) throws ApiProxy.ApiProxyException
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
).
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.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
java.util.concurrent.Future<byte[]> makeAsyncCall(E environment, java.lang.String packageName, java.lang.String methodName, byte[] request, ApiProxy.ApiConfig apiConfig)
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
).
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.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.void log(E environment, ApiProxy.LogRecord record)
void flushLogs(E environment)
java.util.List<java.lang.Thread> getRequestThreads(E environment)