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 Classes Modifier and Type Class Description static classApiProxyImpl.BuilderBuilder for ApiProxyImpl.Config.static classApiProxyImpl.EnvironmentImplTo implement ApiProxy.Environment, we use a class that wraps around an UPRequest and retrieves the necessary information from it.
-
Field Summary
Fields Modifier and Type Field Description static StringBACKEND_ID_KEYstatic StringCLOUD_SQL_JDBC_CONNECTIVITY_ENABLED_KEYstatic StringINSTANCE_ID_KEY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ApiProxyImpl.Builderbuilder()ApiProxyImpl.EnvironmentImplcreateEnvironment(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.voidflushLogs(ApiProxyImpl.EnvironmentImpl environment)List<Thread>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(RequestManager requestManager)
-
-
-
Field Detail
-
BACKEND_ID_KEY
public static final String BACKEND_ID_KEY
- See Also:
- Constant Field Values
-
INSTANCE_ID_KEY
public static final String INSTANCE_ID_KEY
- See Also:
- Constant Field Values
-
CLOUD_SQL_JDBC_CONNECTIVITY_ENABLED_KEY
public static final String CLOUD_SQL_JDBC_CONNECTIVITY_ENABLED_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static ApiProxyImpl.Builder builder()
-
setRequestManager
public void setRequestManager(RequestManager requestManager)
-
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
public void flushLogs(ApiProxyImpl.EnvironmentImpl environment)
- Specified by:
flushLogsin interfacecom.google.apphosting.api.ApiProxy.Delegate<ApiProxyImpl.EnvironmentImpl>
-
getRequestThreads
public List<Thread> getRequestThreads(ApiProxyImpl.EnvironmentImpl environment)
- 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.
-
-