Examples of scheduleWithFixedDelay()


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

     */
    @Test
    @Ignore
    public void testConcurrentGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 10, 2, TimeUnit.MILLISECONDS);
View Full Code Here

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

     */
    @Test
    @Ignore
    public void testConcurrentMergeGC() throws Exception {
        ScheduledExecutorService gcExecutor = Executors.newScheduledThreadPool(1);
        gcExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                rs.gc();
            }
        }, 100, 20, TimeUnit.MILLISECONDS);
View Full Code Here

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

    /**
     * Schedules a background task for flushing the index once per second.
     */
    private void scheduleFlushTask() {
        ScheduledExecutorService executor = handler.getContext().getExecutor();
        flushTask = executor.scheduleWithFixedDelay(new Runnable() {
            public void run() {
                // check if there are any indexing jobs finished
                checkIndexingQueue(false);
                // check if volatile index should be flushed
                checkFlush();
View Full Code Here

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

                Thread t = new Thread(runable, "OwbConversationCleaner-" + servletContext.getContextPath());
                t.setDaemon(true);
                return t;
            }
        });
        executorService.scheduleWithFixedDelay(new ConversationCleaner(context), delay, delay, TimeUnit.MILLISECONDS);

        ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
        ELResolver resolver = elAdaptor.getOwbELResolver();
        //Application is configured as JSP
        if (context.getOpenWebBeansConfiguration().isJspApplication()) {
View Full Code Here

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

      ScheduledExecutorService mockService = mock(ScheduledExecutorService.class);
      em.initialize(mockService, "", cfg, null, null, null);

      ScheduledFuture mockFuture = mock(ScheduledFuture.class);
      when(mockService.scheduleWithFixedDelay(isA(EvictionManagerImpl.ScheduledTask.class), eq(789l),
                                                eq(789l), eq(TimeUnit.MILLISECONDS)))
            .thenReturn(mockFuture);
      em.start();

      assert em.evictionTask == mockFuture;
View Full Code Here

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

   @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);

      replay(mockFuture);
      replay(schedulerMock);
View Full Code Here

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

   @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);

      replay(mockFuture);
      replay(schedulerMock);
View Full Code Here

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

   @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);

      replay(mockFuture);
      replay(schedulerMock);
View Full Code Here

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

   @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);

      replay(mockFuture);
      replay(schedulerMock);
View Full Code Here

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

   @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);

      replay(mockFuture);
      replay(schedulerMock);
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.