Package com.google.apphosting.runtime
Class ApiProxyImpl
java.lang.Object
com.google.apphosting.runtime.ApiProxyImpl
- All Implemented Interfaces:
com.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
public class ApiProxyImpl
extends Object
implements com.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
ApiProxyImpl is a concrete implementation of the ApiProxy.Delegate
interface.
It receives user-supplied API calls, translates them into the APIRequest arguments that APIHost expects, calls the asynchronous APIHost service, and translates any return value or error condition back into something that the user would expect.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for ApiProxyImpl.Config.static classA thread created by {@code ThreadManager.currentRequestThreadFactory().static final classTo implement ApiProxy.Environment, we use a class that wraps around an UPRequest and retrieves the necessary information from it. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ApiProxyImpl.Builderbuilder()createEnvironment(AppVersion appVersion, com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest, MutableUpResponse upResponse, TraceWriter traceWriter, CpuRatioTimer requestTimer, String requestId, List<Future<?>> asyncFutures, Semaphore outstandingApiRpcSemaphore, ThreadGroup requestThreadGroup, RequestState requestState, Long millisUntilSoftDeadline) Creates anApiProxy.Environmentinstance that is suitable for use with this class.voiddisable()voidenable()voidflushLogs(ApiProxyImpl.EnvironmentImpl environment) getRequestThreads(ApiProxyImpl.EnvironmentImpl environment) voidlog(ApiProxyImpl.EnvironmentImpl environment, com.google.apphosting.api.ApiProxy.LogRecord record) Future<byte[]>makeAsyncCall(ApiProxyImpl.EnvironmentImpl environment, String packageName, String methodName, byte[] request, com.google.apphosting.api.ApiProxy.ApiConfig apiConfig) byte[]makeSyncCall(ApiProxyImpl.EnvironmentImpl environment, String packageName, String methodName, byte[] request) voidsetRequestManager(RequestThreadManager requestThreadManager)
-
Field Details
-
BACKEND_ID_KEY
- See Also:
-
INSTANCE_ID_KEY
- See Also:
-
CLOUD_SQL_JDBC_CONNECTIVITY_ENABLED_KEY
- See Also:
-
-
Method Details
-
builder
-
setRequestManager
-
disable
public void disable() -
enable
public void enable() -
makeSyncCall
public byte[] makeSyncCall(ApiProxyImpl.EnvironmentImpl environment, String packageName, String methodName, byte[] request) - Specified by:
makeSyncCallin interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
makeAsyncCall
public Future<byte[]> makeAsyncCall(ApiProxyImpl.EnvironmentImpl environment, String packageName, String methodName, byte[] request, com.google.apphosting.api.ApiProxy.ApiConfig apiConfig) - Specified by:
makeAsyncCallin interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
log
public void log(ApiProxyImpl.EnvironmentImpl environment, com.google.apphosting.api.ApiProxy.LogRecord record) - Specified by:
login interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
flushLogs
- Specified by:
flushLogsin interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
getRequestThreads
- Specified by:
getRequestThreadsin interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
createEnvironment
public ApiProxyImpl.EnvironmentImpl createEnvironment(AppVersion appVersion, com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest, MutableUpResponse upResponse, @Nullable TraceWriter traceWriter, CpuRatioTimer requestTimer, String requestId, List<Future<?>> asyncFutures, Semaphore outstandingApiRpcSemaphore, ThreadGroup requestThreadGroup, RequestState requestState, @Nullable Long millisUntilSoftDeadline) Creates anApiProxy.Environmentinstance that is suitable for use with this class.
-