google-app-engine - Google App Engine modifyThreadGroup 问题

标签 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)

为什么,如何解决?

弗兰克

最佳答案

您不能在 GAE 中使用线程。这是 things you cannot do in GAE 的列表:

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

关于google-app-engine - Google App Engine modifyThreadGroup 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2708817/

相关文章:

android - Gradle 同步失败 : Expected configuration ':backend:appengineSdk' to contain exactly one file, 但是,它不包含任何文件

python - 从元组列表中提取值(在这种情况下,列表中只有一个元组)

javascript - Google Appengine 中的 Holder.js (python)

google-app-engine - 在 GQL 中计算结果的最佳方法是什么?

python - 有类似 DatastoreOutputWriter 的东西吗?

node.js - 如何通过 nodeJS 从 Google Datastore 的索引中排除数组字段?

python - 限制来自任何给定 IP 地址的请求数量

php - App Engine 实例激增

java - 如何将网站图标添加到 Google appengine 应用程序

python - 谷歌应用程序引擎启动器上的应用程序错误