Package com.google.apphosting.runtime
Class RequestManager
- java.lang.Object
-
- com.google.apphosting.runtime.RequestManager
-
public class RequestManager extends Object
RequestManager
is responsible for setting up and tearing down any state associated with each request. At the moment, this includes:- Injecting an
Environment
implementation for the request's thread intoApiProxy
. - Scheduling any future actions that must occur while the request is executing (e.g. deadline exceptions), and cleaning up any scheduled actions that do not occur.
RequestManager.RequestToken token = requestManager.startRequest(...); try { ... } finally { requestManager.finishRequest(token); }
- Injecting an
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RequestManager.Builder
Builder for of a RequestManager instance.class
RequestManager.DeadlineRunnable
DeadlineRunnable
causes the specifiedThrowable
to be thrown within the specified thread.static class
RequestManager.RequestToken
RequestToken
acts as a Memento object that passes state between a call tostartRequest
andfinishRequest
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RequestManager.Builder
builder()
Make a partly-initialized builder for a RequestManager.void
disableCloudDebugger()
Disables Cloud Debugger.void
finishRequest(RequestManager.RequestToken requestToken)
Tear down any state associated with the specified request, and restore the current thread's state as it was beforestartRequest
was called.void
sendDeadline(RequestManager.RequestToken token, boolean isUncatchable)
void
sendDeadline(String securityTicket, boolean isUncatchable)
void
setMaxOutstandingApiRpcs(int maxOutstandingApiRpcs)
void
shutdownRequests(RequestManager.RequestToken token)
Notify requests that the server is shutting down.RequestManager.RequestToken
startRequest(AppVersion appVersion, AnyRpcServerContext rpc, com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest, MutableUpResponse upResponse, ThreadGroup requestThreadGroup)
Set up any state necessary to execute a new request using the specified parameters.
-
-
-
Method Detail
-
builder
public static RequestManager.Builder builder()
Make a partly-initialized builder for a RequestManager.
-
setMaxOutstandingApiRpcs
public void setMaxOutstandingApiRpcs(int maxOutstandingApiRpcs)
-
disableCloudDebugger
public void disableCloudDebugger()
Disables Cloud Debugger.If called before the first request has been processed, the Cloud Debugger will not be even activated.
-
startRequest
public RequestManager.RequestToken startRequest(AppVersion appVersion, AnyRpcServerContext rpc, com.google.apphosting.base.protos.RuntimePb.UPRequest upRequest, MutableUpResponse upResponse, ThreadGroup requestThreadGroup)
Set up any state necessary to execute a new request using the specified parameters. The current thread should be the one that will execute the new request.- Returns:
- a
RequestToken
that should be passed intofinishRequest
after the request completes.
-
finishRequest
public void finishRequest(RequestManager.RequestToken requestToken)
Tear down any state associated with the specified request, and restore the current thread's state as it was beforestartRequest
was called.- Throws:
IllegalStateException
- if called from the wrong thread.
-
sendDeadline
public void sendDeadline(String securityTicket, boolean isUncatchable)
-
sendDeadline
public void sendDeadline(RequestManager.RequestToken token, boolean isUncatchable)
-
shutdownRequests
public void shutdownRequests(RequestManager.RequestToken token)
Notify requests that the server is shutting down.
-
-