Google App Engine modifyThreadGroup问题

时间:2010-04-25 15:54:55

标签: google-app-engine

我正在使用Google App Engine来处理Paypal IPN消息,当我的servlet启动时,我使用以下行开始另一个流程来处理按摩:

public class PayPal_Monitor_Servlet extends HttpServlet
{
  PayPal_Message_To_License_File_Worker PayPal_message_to_license_file_worker;

  public void init(ServletConfig config) throws ServletException               // Initializes the servlet.
  {
    super.init(config);
    PayPal_message_to_license_file_worker=new PayPal_Message_To_License_File_Worker();
   }

  public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException
  {
  }

...
}

public class PayPal_Message_To_License_File_Worker implements Runnable
{
  static Thread PayPal_Message_To_License_File_Thread;
...

  PayPal_Message_To_License_File_Worker()
  {
    start();
  }

  void start()
  {
    if (PayPal_Message_To_License_File_Thread==null)
    {
      PayPal_Message_To_License_File_Thread=new Thread(this);
      PayPal_Message_To_License_File_Thread.setPriority(Thread.MIN_PRIORITY);
      PayPal_Message_To_License_File_Thread.start();
    }
...
  }

但是“PayPal_Message_To_License_File_Thread = new Thread(this);”导致以下错误:

javax.servlet.ServletContext log: unavailable
java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:355)
    at java.security.AccessController.checkPermission(AccessController.java:567)

为什么,如何解决?

2 个答案:

答案 0 :(得分:14)

您无法在GAE中使用线程。以下是things you cannot do in GAE的列表:

如果您想异步执行某些操作,请查看TaskQueues。

答案 1 :(得分:0)

你应该使用树脂4.0.22或更低。关于http://forum.caucho.com/showthread.php?t=28521