Class RequestThreadFactory

java.lang.Object
com.google.appengine.setup.RequestThreadFactory
All Implemented Interfaces:
ThreadFactory

public class RequestThreadFactory extends Object implements ThreadFactory
Thread factory creating threads with a request specific thread local environment.
  • Constructor Details

    • RequestThreadFactory

      public RequestThreadFactory(ApiProxy.Environment requestEnvironment)
      Create a new VmRequestThreadFactory.
      Parameters:
      requestEnvironment - The request environment to install on each thread.
  • Method Details

    • newThread

      public Thread newThread(Runnable runnable)
      Create a new Thread that executes runnable for the duration of the current request. This thread will be interrupted at the end of the current request.
      Specified by:
      newThread in interface ThreadFactory
      Parameters:
      runnable - The object whose run method is invoked when this thread is started. If null, this classes run method does nothing.
      Throws:
      ApiProxy.ApiProxyException - If called outside of a running request.
      IllegalStateException - If called after the request thread stops.
    • getRequestThreads

      public List<Thread> getRequestThreads()
      Returns an immutable copy of the current request thread list.