Class BackgroundRequestCoordinator

java.lang.Object
com.google.apphosting.runtime.BackgroundRequestCoordinator

public class BackgroundRequestCoordinator extends Object
BackgroundRequestCoordinator facilitates the exchange of two pieces of data between the background ThreadFactory and the JavaRuntime code that processes the fake request.

Background threads are backed by a "fake" request, which is initiated using the System API. The System API will return a request identifier and also initiate a "fake" request with this identifier stored in a header. The runtime must match each fake request up with the original API call and pass the user's Runnable to the thread so it can be executed, and pass the Thread back to the user's code so it can be joined and referenced.

Unfortunately there is a race between these two threads. We don't know whether the System API RPC will return first or whether the background request will be received first.