Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine modifyThreadGroup problem

I'm using Google App Engine to process Paypal IPN messages, when my servlet starts I use the following lines to start another process to process massages :

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();
    }
...
  }

But "PayPal_Message_To_License_File_Thread=new Thread(this);" is causing the following error :

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)

Why, how to fix it ?

Frank

like image 522
Frank Avatar asked Apr 25 '10 15:04

Frank


1 Answers

You cannot use Threads in GAE. Here is a list of things you cannot do in GAE:

If you want to do something asynchronously, look into TaskQueues.

like image 150
Romain Hippeau Avatar answered Sep 20 '22 09:09

Romain Hippeau