1 Reply Latest reply on May 23, 2012 12:07 PM by rukbat

    How to Shutdown my own Executor under Security Manager

      I have my Batch Application Program, in which I am using ThreadPoolExecutor in my Batch Application Program. So as soon as it hits the-


      line in my Batch Application program, I always get this below error in my Batch Application Program. And I am not able to ShutDown my own Executor Service. Can anyone suggest me how should I overcome this error.

      causedByException=java.security.AccessControlException : Access denied (java.lang.RuntimePermission modifyThread)

      How can I shut down my own ExecutorService under SecurityManager.

      I am using Windows7 and Java6-IBM(java6-ibm-sr4ifx3-2009-06-22).

      I am trying to shut down like this-

      // create thread pool with given size
                     ExecutorService service = Executors.newFixedThreadPool(10);

                     // queue some tasks
                     for(int i = 0; i < 3 * 10; i++) {
                          service.submit(new ThreadTask(i));

                     // wait for termination
                     try {
                          if (!service.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS)) {
                     } catch (final InterruptedException pCaught) {