Java 8 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Java 8
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Java
8 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Java.
ApiProxy.Delegate (Google App Engine API for Java)
Stay organized with collections
Save and categorize content based on your preferences.
-
-
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)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003e\u003ccode\u003eApiProxy.Delegate\u003c/code\u003e is an interface that provides a way to implement API calls.\u003c/p\u003e\n"],["\u003cp\u003eIt supports both synchronous (\u003ccode\u003emakeSyncCall\u003c/code\u003e) and asynchronous (\u003ccode\u003emakeAsyncCall\u003c/code\u003e) API calls to specified methods within an API package.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emakeSyncCall\u003c/code\u003e method allows synchronous API calls, but will throw a \u003ccode\u003eCallNotFoundException\u003c/code\u003e if a \u003ccode\u003eDelegate\u003c/code\u003e isn't installed and the environment isn't set.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emakeAsyncCall\u003c/code\u003e method allows asynchronous API calls, and returns a \u003ccode\u003eFuture\u003c/code\u003e object that will eventually contain the response or an exception.\u003c/p\u003e\n"],["\u003cp\u003eThe interface also includes methods to manage logging (\u003ccode\u003elog\u003c/code\u003e, \u003ccode\u003eflushLogs\u003c/code\u003e) and to retrieve a list of active request threads (\u003ccode\u003egetRequestThreads\u003c/code\u003e).\u003c/p\u003e\n"]]],[],null,["# ApiProxy.Delegate (Google App Engine API for Java)\n\ncom.google.apphosting.api\n\nInterface ApiProxy.Delegate\\\u003cE extends [ApiProxy.Environment](../../../../com/google/apphosting/api/ApiProxy.Environment.html \"interface in com.google.apphosting.api\")\\\u003e\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n-\n\n Type Parameters:\n : `E` - The concrete class implementing Environment that this\n Delegate expects to receive.\n\n Enclosing class:\n : [ApiProxy](../../../../com/google/apphosting/api/ApiProxy.html \"class in com.google.apphosting.api\")\n\n *** ** * ** ***\n\n \u003cbr /\u003e\n\n ```\n public static interface ApiProxy.Delegate\u003cE extends ../../../../com/google/apphosting/api/ApiProxy.Environment.html\u003e\n ``` \nThis interface can be used to provide a class that actually implements API calls. \n-\n -\n\n ### Method Summary\n\n-\n -\n\n ### Method Detail\n\n\n -\n\n #### makeSyncCall\n\n ```\n byte[] makeSyncCall(E environment,\n java.lang.String packageName,\n java.lang.String methodName,\n byte[] request)\n throws ApiProxy.ApiProxyException\n ``` \n Make a synchronous call to the specified method in the specified API package.\n\n Note: if you have not installed a `Delegate` and called\n `setEnvironmentForCurrentThread` in this thread before\n calling this method, it will act like no API calls are available\n (i.e. always throw `CallNotFoundException`).\n\n Parameters:\n : `environment` - the current request environment.\n : `packageName` - the name of the API package.\n : `methodName` - the name of the method within the API package.\n : `request` - a byte array containing the serialized form of\n the request protocol buffer.\n\n Returns:\n : a byte array containing the serialized form of the\n response protocol buffer.\n\n Throws:\n : [ApiProxy.ApplicationException](../../../../com/google/apphosting/api/ApiProxy.ApplicationException.html \"class in com.google.apphosting.api\") - For any error that is the application's fault.\n : [ApiProxy.RPCFailedException](../../../../com/google/apphosting/api/ApiProxy.RPCFailedException.html \"class in com.google.apphosting.api\") - If we could not connect to a backend service.\n : [ApiProxy.CallNotFoundException](../../../../com/google/apphosting/api/ApiProxy.CallNotFoundException.html \"class in com.google.apphosting.api\") - If the specified method does not exist.\n : [ApiProxy.ArgumentException](../../../../com/google/apphosting/api/ApiProxy.ArgumentException.html \"class in com.google.apphosting.api\") - If the request could not be parsed.\n : [DeadlineExceededException](../../../../com/google/apphosting/api/DeadlineExceededException.html \"class in com.google.apphosting.api\") - If the request took too long.\n : [ApiProxy.CancelledException](../../../../com/google/apphosting/api/ApiProxy.CancelledException.html \"class in com.google.apphosting.api\") - If the request was explicitly cancelled.\n : [ApiProxy.UnknownException](../../../../com/google/apphosting/api/ApiProxy.UnknownException.html \"class in com.google.apphosting.api\") - If any other error occurred.\n : [ApiProxy.ApiProxyException](../../../../com/google/apphosting/api/ApiProxy.ApiProxyException.html \"class in com.google.apphosting.api\")\n\n\n -\n\n #### makeAsyncCall\n\n ```\n java.util.concurrent.Future\u003cbyte[]\u003e makeAsyncCall(E environment,\n java.lang.String packageName,\n java.lang.String methodName,\n byte[] request,\n ApiProxy.ApiConfig apiConfig)\n ``` \n Make an asynchronous call to the specified method in the specified API package.\n\n Note: if you have not installed a `Delegate` and called\n `setEnvironmentForCurrentThread` in this thread before\n calling this method, it will act like no API calls are available\n (i.e. always throw `CallNotFoundException`).\n\n Parameters:\n : `environment` - the current request environment.\n : `packageName` - the name of the API package.\n : `methodName` - the name of the method within the API package.\n : `request` - a byte array containing the serialized form of\n the request protocol buffer.\n : `apiConfig` - that specifies API-specific configuration\n parameters.\n\n Returns:\n : a `Future` that will resolve to a byte array\n containing the serialized form of the response protocol buffer\n on success, or throw one of the exceptions documented for\n `#makeSyncCall(Environment, String, String, byte[])` on failure.\n\n\n -\n\n #### log\n\n ```\n void log(E environment,\n ApiProxy.LogRecord record)\n ```\n\n\n -\n\n #### flushLogs\n\n ```\n void flushLogs(E environment)\n ```\n\n\n -\n\n #### getRequestThreads\n\n ```\n java.util.List\u003cjava.lang.Thread\u003e getRequestThreads(E environment)\n ``` \n Returns a list of all threads which are currently running requests."]]