Package java.util.concurrent

Examples of java.util.concurrent.ScheduledExecutorService.shutdownNow()


                public void run() {
                    executorService.shutdownNow();
                }
            });
        } catch (IllegalStateException e) {
            executorService.shutdownNow();
            throw new IllegalStateException("Unable to create registry event dispatcher during " +
                    "shutdown process.");
        }
    }
View Full Code Here


        final ScheduledExecutorService scheduler =
                Executors.newScheduledThreadPool(10);
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                scheduler.shutdownNow();
            }
        });
        Runnable runnable = new Runnable() {
            public void run() {
                if (log.isDebugEnabled()) {
View Full Code Here

            });
            final ScheduledExecutorService scheduler =
                    Executors.newScheduledThreadPool(10);
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    scheduler.shutdownNow();
                }
            });
            Runnable runnable = new Runnable() {
                public void run() {
                    if (connectionStatistics == null) {
View Full Code Here

        }
        final ScheduledExecutorService scheduler =
                Executors.newSingleThreadScheduledExecutor();
        Runtime.getRuntime().addShutdownHook(new Thread(){
            public void run() {
                scheduler.shutdownNow();
            }
        });
        Runnable runnable = new Runnable() {
            public void run() {
                if (records == null) {
View Full Code Here

        {
          _shutdown.set(true);
         
          ScheduledExecutorService s = _default.get();
         
          if (s != null) s.shutdownNow();
         
          List<Runnable> runnables = new ArrayList<Runnable>();
         
          for (Discardable<Runnable> r : _unprocessedWork) {
            Runnable newRunnable = r.discard();
View Full Code Here

        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
            }
        } catch (InterruptedException e) {
            log.warn("Interrupted while waiting for background threads", e);
        }
View Full Code Here

  }

  public void testShutdownNowIsPropagatedToTheExecutorOnDestroy() throws Exception {
    MockControl mockScheduledExecutorService = MockControl.createNiceControl(ScheduledExecutorService.class);
    final ScheduledExecutorService executor = (ScheduledExecutorService) mockScheduledExecutorService.getMock();
    executor.shutdownNow();
    mockScheduledExecutorService.setReturnValue(null);
    mockScheduledExecutorService.replay();

    ScheduledExecutorFactoryBean factory = new ScheduledExecutorFactoryBean() {
      protected ScheduledExecutorService createExecutor(int poolSize, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler) {
View Full Code Here

        executor.shutdown();
        try {
            // Wait for all remaining background threads to terminate
            if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
                log.warn("Attempting to forcibly shutdown runaway threads");
                executor.shutdownNow();
            }
        } catch (InterruptedException e) {
            log.warn("Interrupted while waiting for background threads", e);
        }
View Full Code Here

                    // Ignore
                }

                start(this.findContainer(target));
            } finally {
                executor.shutdownNow();
            }
        } finally {
            EJBClientContext.setSelector(selector);
        }
    }
View Full Code Here

        stompConnection.sendFrame(frame);

        StompFrame stompFrame = stompConnection.receive();
        assertTrue(stompFrame.getAction().equals("MESSAGE"));

        service.shutdownNow();

        frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
        stompConnection.sendFrame(frame);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.