Package java.util.concurrent

Examples of java.util.concurrent.ScheduledFuture


    public void complete(int sequenceNumber)
    {
        boolean signalComplete;
        synchronized (this)
        {
            ScheduledFuture timeout = timeoutTasks.remove(sequenceNumber);
            if (timeout != null)
                timeout.cancel(false);

            OutgoingFileMessage file = files.remove(sequenceNumber);
            if (file != null)
                file.sstable.releaseReference();
View Full Code Here


    }

    public synchronized OutgoingFileMessage createMessageForRetry(int sequenceNumber)
    {
        // remove previous time out task to be rescheduled later
        ScheduledFuture future = timeoutTasks.remove(sequenceNumber);
        if (future != null)
            future.cancel(false);
        return files.get(sequenceNumber);
    }
View Full Code Here

  @Autowired
  private TransactionService transactionService;

  public void addFixedDelayedScheduledTask(Runnable runnable, int delay) {
    final ScheduledFuture scheduledFuture = taskScheduler.scheduleWithFixedDelay(runnable, delay);
    scheduledRunnable.put(runnable, scheduledFuture);
  }
View Full Code Here

        } catch (BeanCreationNotAllowedException e) {
          noOp();
        }
      }
    };
    final ScheduledFuture scheduledFuture = taskScheduler.scheduleWithFixedDelay(transactionalRunnable, delay);
    scheduledRunnable.put(runnable, scheduledFuture);
  }
View Full Code Here

    final ScheduledFuture scheduledFuture = taskScheduler.scheduleWithFixedDelay(transactionalRunnable, delay);
    scheduledRunnable.put(runnable, scheduledFuture);
  }

  public void removeScheduledJob(Runnable runnable) {
    final ScheduledFuture scheduledTaskInfo = scheduledRunnable.remove(runnable);
    if (scheduledTaskInfo != null) {
      scheduledTaskInfo.cancel(false);
    }
  }
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

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.