无法调用run方法

时间:2012-05-18 02:49:57

标签: java

当我运行我的批处理应用程序(一个以下)时,它首先进入execute方法,然后每当它尝试创建一个CoreTask()的实例时,它就不会遇到CoreTask类中的run方法,是有什么不对吗?

public class PDSBatchTask extends Task {

    public TaskResponse execute() {
        try {
            Runnable coreTask = new CoreTask();
            ScheduledFuture<?> scheduledFuture = Executors.newScheduledThreadPool(1).scheduleWithFixedDelay(coreTask, 0, 10, TimeUnit.MILLISECONDS);

            return new TaskResponse(
                    PDSTestingBatchExitCodeEnum.EXIT_CODE_SUCCESS);
        } catch (Exception e) {

        } 
    }

    private static final class CoreTask implements Runnable {
            // When I put a breakpoint here, it doesn't hit the run method.
            public void run() {
                CommandExecutor commandExecutor = CommandExecutor.getInstance();
                commandExecutor.runNextCommand();
            }
        }

}

0 个答案:

没有答案