我正在尝试在 Google App 引擎中使用执行器框架。贝娄是我试图运行的代码。
Thread thread = ThreadManager.createBackgroundThread(new Runnable(){
public void run(){
try{
LOGGER.info( "Checking background thread");
Thread.sleep(10);
}
catch (InterruptedException ex){
throw new RuntimeException("Exception:", ex);
}
}
});
ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(10, ThreadManager.backgroundThreadFactory());
executor.scheduleAtFixedRate(thread, 0, 30, TimeUnit.MINUTES);
但这不会启动线程。但是如果我使用thread.start()它可以正常工作。我检查了Whitelisted Classes,它确实提供了 Executor 类。那么我在哪里做错了?