我使用谷歌應用程序引擎來處理貝寶IPN的消息,當我的servlet開始我用下面的行啓動另一個進程來處理按摩:谷歌應用程序引擎modifyThreadGroup問題
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 =新螺紋(本);」導致以下錯誤:
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)
爲什麼,如何解決它?
Frank
2012年底更新:您可以使用App Engine上的線程,但有一些限制:https://developers.google.com/appengine/docs/java/runtime#The_Sandbox – 2012-12-26 19:10:13