Package java.util.concurrent

Examples of java.util.concurrent.ScheduledFuture


    }

    @SuppressWarnings("unchecked")
    @Test
    public void scheduleWithFixedDelay() {
        @SuppressWarnings("rawtypes")
        ScheduledFuture expected = mock(ScheduledFuture.class);
        Runnable task = mock(Runnable.class);
        long delay = 10L;
        long period = 20L;
        TimeUnit unit = TimeUnit.SECONDS;
View Full Code Here


          Callable<Void> callableJob = createCallableJob( job,
                                                            ctx,
                                                            trigger,
                                                            jobHandle,
                                                            this.scheduler );
            ScheduledFuture future = schedule( date,
                                               callableJob,
                                               this.scheduler );
            jobHandle.setFuture( future );

            return jobHandle;
View Full Code Here

            new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );

        logger.info( "schedule merge remote index for group {} with cron {}", repositoryGroup.getId(),
                     repositoryGroup.getCronExpression() );

        ScheduledFuture scheduledFuture =
            taskScheduler.schedule( new MergedRemoteIndexesTask( taskRequest ), cronTrigger );
        scheduledFutureMap.put( repositoryGroup.getId(), scheduledFuture );
    }
View Full Code Here

    }

    @Override
    public void unschedule( RepositoryGroup repositoryGroup )
    {
        ScheduledFuture scheduledFuture = scheduledFutureMap.remove( repositoryGroup.getId() );
        if ( scheduledFuture != null )
        {
            scheduledFuture.cancel( true );
        }
    }
View Full Code Here

*/
@Test(groups = "unit", testName = "AsyncMonitorTest")
public class AsyncMonitorTest {
   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testStartMonitoringWithoutTimeout() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);

View Full Code Here

      monitor.startMonitoring(100L, null);
   }

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testStartMonitoringWithoutTimeoutAndNullTimeUnit() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);
View Full Code Here

      verify(schedulerMock);
   }

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testStartMonitoringWithTimeout() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);
View Full Code Here

      verify(schedulerMock);
   }

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testStartMonitoringWithTimeoutInMinutes() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);
View Full Code Here

      verify(schedulerMock);
   }

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testIsTimeoutWhenNullTimeout() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);
View Full Code Here

      verify(schedulerMock);
   }

   @SuppressWarnings({ "rawtypes", "unchecked" })
   public void testIsTimeoutReturnsFalseWhenNotFinished() {
      ScheduledFuture mockFuture = EasyMock.createMock(ScheduledFuture.class);
      ScheduledExecutorService schedulerMock = EasyMock.createMock(ScheduledExecutorService.class);
      expect(
            schedulerMock.scheduleWithFixedDelay(anyObject(Runnable.class), anyLong(), anyLong(),
                  anyObject(TimeUnit.class))).andReturn(mockFuture);
View Full Code Here

TOP

Related Classes of java.util.concurrent.ScheduledFuture

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.