com.google.appengine.api
Class ThreadManager

java.lang.Object
  extended by com.google.appengine.api.ThreadManager

public final class ThreadManager
extends java.lang.Object

ThreadManager exposes a ThreadFactory that allows App Engine applications to spawn new threads.


Constructor Summary
ThreadManager()
           
 
Method Summary
static java.lang.Thread createThreadForCurrentRequest(java.lang.Runnable runnable)
          Create a new Thread that executs runnable.
static java.util.concurrent.ThreadFactory currentRequestThreadFactory()
          Returns a ThreadFactory that will create threads scoped to the current request.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadManager

public ThreadManager()
Method Detail

currentRequestThreadFactory

public static java.util.concurrent.ThreadFactory currentRequestThreadFactory()
Returns a ThreadFactory that will create threads scoped to the current request. These threads will be interrupted at the end of the current request and must complete within the request deadline.

Your code has limited access to the threads created by this ThreadFactory. For example, you can call Thread.setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) and Thread.interrupt(), but not Thread.stop() or any other methods that require RuntimePermission("modifyThread").


createThreadForCurrentRequest

public static java.lang.Thread createThreadForCurrentRequest(java.lang.Runnable runnable)
Create a new Thread that executs runnable. Calling this method is equivalent to invoking ThreadFactory#run on the ThreadFactory returned from {#link #currentRequestThreadFactory}. This thread will be interrupted at the end of the current request and must complete within the request deadline.