Package java.util.concurrent

Examples of java.util.concurrent.ScheduledExecutorService


        if (listenerExecutor != null) {
            // See ISPN-1675
            // globalBuilder.asyncListenerExecutor().factory(new ManagedExecutorFactory(listenerExecutor));
            ExecutorProvider.initListenerExecutor(builder, listenerExecutor);
        }
        ScheduledExecutorService evictionExecutor = this.dependencies.getEvictionExecutor();
        if (evictionExecutor != null) {
            // See ISPN-1675
            // globalBuilder.evictionScheduledExecutor().factory(new ManagedScheduledExecutorFactory(evictionExecutor));
            ExecutorProvider.initEvictionExecutor(builder, evictionExecutor);
        }
        ScheduledExecutorService replicationQueueExecutor = this.dependencies.getReplicationQueueExecutor();
        if (replicationQueueExecutor != null) {
            // See ISPN-1675
            // globalBuilder.replicationQueueScheduledExecutor().factory(new ManagedScheduledExecutorFactory(replicationQueueExecutor));
            ExecutorProvider.initReplicationQueueExecutor(builder, replicationQueueExecutor);
        }
View Full Code Here


         PageCursorsInfo cursorACKs = PrintPages.loadCursorACKs(arg[1]);

         Set<Long> pgTXs = cursorACKs.getPgTXs();

         ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1);
         final ExecutorService executor = Executors.newFixedThreadPool(10);
         ExecutorFactory execfactory = new ExecutorFactory()
         {

            public Executor getExecutor()
View Full Code Here

    */
   private void printPagedMessagesAsXML()
   {
      try
      {
         ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1);
         final ExecutorService executor = Executors.newFixedThreadPool(10);
         ExecutorFactory executorFactory = new ExecutorFactory()
         {
            public Executor getExecutor()
            {
View Full Code Here

            answer.setAggregationRepository(repository);
        }

        // this EIP supports using a shared timeout checker thread pool or fallback to create a new thread pool
        boolean shutdownTimeoutThreadPool = false;
        ScheduledExecutorService timeoutThreadPool = timeoutCheckerExecutorService;
        if (timeoutThreadPool == null && timeoutCheckerExecutorServiceRef != null) {
            // lookup existing thread pool
            timeoutThreadPool = routeContext.getCamelContext().getRegistry().lookupByNameAndType(timeoutCheckerExecutorServiceRef, ScheduledExecutorService.class);
            if (timeoutThreadPool == null) {
                // then create a thread pool assuming the ref is a thread pool profile id
View Full Code Here

    /**
     * Tests creating a new instance.
     */
    @Test
    public void testInit() {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        EasyMock.replay(service);
        TimedSemaphore semaphore = new TimedSemaphore(service, PERIOD, UNIT,
                LIMIT);
        EasyMock.verify(service);
View Full Code Here

     * Tests the shutdown() method for a shared executor service before a task
     * was started. This should do pretty much nothing.
     */
    @Test
    public void testShutdownSharedExecutorNoTask() {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        EasyMock.replay(service);
        TimedSemaphore semaphore = new TimedSemaphore(service, PERIOD, UNIT,
                LIMIT);
        semaphore.shutdown();
View Full Code Here

     * Tests the shutdown() method for a shared executor after the task was
     * started. In this case the task must be canceled.
     */
    @Test
    public void testShutdownSharedExecutorTask() throws InterruptedException {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        ScheduledFuture<?> future = EasyMock.createMock(ScheduledFuture.class);
        prepareStartTimer(service, future);
        EasyMock.expect(Boolean.valueOf(future.cancel(false))).andReturn(Boolean.TRUE);
        EasyMock.replay(service, future);
View Full Code Here

    /**
     * Tests multiple invocations of the shutdown() method.
     */
    @Test
    public void testShutdownMultipleTimes() throws InterruptedException {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        ScheduledFuture<?> future = EasyMock.createMock(ScheduledFuture.class);
        prepareStartTimer(service, future);
        EasyMock.expect(Boolean.valueOf(future.cancel(false))).andReturn(Boolean.TRUE);
        EasyMock.replay(service, future);
View Full Code Here

    /**
     * Tests the acquire() method if a limit is set.
     */
    @Test
    public void testAcquireLimit() throws InterruptedException {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        ScheduledFuture<?> future = EasyMock.createMock(ScheduledFuture.class);
        prepareStartTimer(service, future);
        EasyMock.replay(service, future);
        final int count = 10;
View Full Code Here

     * semaphore's limit is set to 1, so in each period only a single thread can
     * acquire the semaphore.
     */
    @Test
    public void testAcquireMultipleThreads() throws InterruptedException {
        ScheduledExecutorService service = EasyMock
                .createMock(ScheduledExecutorService.class);
        ScheduledFuture<?> future = EasyMock.createMock(ScheduledFuture.class);
        prepareStartTimer(service, future);
        EasyMock.replay(service, future);
        TimedSemaphoreTestImpl semaphore = new TimedSemaphoreTestImpl(service,
View Full Code Here

TOP

Related Classes of java.util.concurrent.ScheduledExecutorService

Copyright © 2018 www.massapicom. 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.