Package java.util.concurrent

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


            idleSessionChecker.scheduleAtFixedRate(cleanSessionTask, sessionTTLinSec + 10L, sweepIntervalInSec, TimeUnit.SECONDS);
            // accept connections
            acceptConnections(initializer, port);
        } finally {
            // release threads
            idleSessionChecker.shutdownNow();
            if(jmx) {
                MetricsRegistry.unregisterMBeans(port);
            }
            metricCollector.shutdownNow();
        }
View Full Code Here


                TimeUnit.MILLISECONDS );


        Thread.sleep( 10700 );

        executor.shutdownNow();
        ksession.halt();
        t.join();

        System.out.println( "Final size " + ksession.getObjects().size() );
View Full Code Here

      if (!latch.await(60, TimeUnit.SECONDS))
      {
        fail("unable to shutdown state");
      }

      executorService.shutdownNow();

      assertTrue(executorService.isShutdown(), "ExecutorService should have shut down!");
    }
  }
View Full Code Here

      if (!latch.await(60, TimeUnit.SECONDS))
      {
        fail("unable to shutdown state");
      }

      executorService.shutdownNow();

      assertTrue(executorService.isShutdown(), "ExecutorService should have shut down!");
    }
  }
View Full Code Here

                    client.updateLastAccess();
                }
            };
            service.scheduleAtFixedRate(command, 10, 10, TimeUnit.MILLISECONDS);
            client.inTransaction().create().forPath("/foo", "data".getBytes()).and().commit();
            service.shutdownNow();
            Thread.sleep(2000);

            Assert.assertNull(client.getCleanup());
            Assert.assertNull(client.getClient());
        }
View Full Code Here

        });

        text.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent e) {
                service.shutdownNow();
            }
        });

        return text;
    }
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

        PollingReadAttributeTask command = new PollingReadAttributeTask(mockAttribute, mockClient, 0, true, mockLogger);
        ScheduledFuture<?> task = singleThreadExecutor.scheduleAtFixedRate(command, 0, Long.MAX_VALUE, TimeUnit.MILLISECONDS);

        Thread.sleep(50);

        List<Runnable> awaitingTasks = singleThreadExecutor.shutdownNow();
        assertEquals(1, awaitingTasks.size());
        //TODO rewrite this test as we can not rely on logger any more (it was disabled due to performance issues)
        //verify(mockLogger, atLeastOnce()).info("Read attribute null: null");
    }
}
View Full Code Here

            context.error(e);
         }
      }
      try {
         sessionPingTask.cancel(true);
         executor.shutdownNow();
         config.save();
         console.stop();
      } catch (Exception e) {
      }
   }
View Full Code Here

            context.error(e);
         }
      }
      try {
         sessionPingTask.cancel(true);
         executor.shutdownNow();
         config.save();
         console.stop();
      } catch (Exception e) {
      }
   }
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.