Package java.util.concurrent

Examples of java.util.concurrent.ScheduledThreadPoolExecutor.execute()


        TestTailerListener listener = new TestTailerListener();
        int delay = 100;
        int idle = 50; // allow time for thread to work
        tailer = new Tailer(file, listener, delay, false);
        Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        tailer=null;
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
View Full Code Here


        TestTailerListener listener = new TestTailerListener();
        int delay = 100;
        int idle = 50; // allow time for thread to work
        tailer = new Tailer(file, listener, delay, false);
        Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        tailer=null;
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
View Full Code Here

    aCtx.setTimeout(25000);// Timeout setted to 25 seconds
    // Add a async events listener
    aCtx.addListener(new Sample02AsyncListener());
    // Launch async processing using a dedicated thread
    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
    executor.execute(new RequestProcessor(aCtx));
    // Never forget to close the executor in order to release all thread
    // objects link in memory...
    executor.shutdown();
    System.out.println("Sample02AsyncServlet::EndOfDoGet");
  }
View Full Code Here

        TestTailerListener listener = new TestTailerListener();
        int delay = 100;
        int idle = 50; // allow time for thread to work
        Tailer tailer = new Tailer(file, listener, delay, false);
        Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
        assertEquals("Expected init to be called", 1 , listener.initialised);
View Full Code Here

        TestTailerListener listener = new TestTailerListener();
        int delay = 100;
        int idle = 50; // allow time for thread to work
        tailer = new Tailer(file, listener, delay, false);
        Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        tailer=null;
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
View Full Code Here

  }

  @Test
  public void testShutdownThreadPool() throws InterruptedException {
    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
    executor.execute(sampleRunnable);
    boolean ret = ShutdownThreadsHelper.shutdownExecutorService(executor);
    boolean isTerminated = executor.isTerminated();
    assertEquals("Incorrect return value", ret, isTerminated);
    assertTrue("ExecutorService is not shutdown", isTerminated);
  }
View Full Code Here

        TestTailerListener listener = new TestTailerListener();
        int delay = 100;
        int idle = 50; // allow time for thread to work
        tailer = new Tailer(file, listener, delay, false);
        Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        tailer=null;
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
View Full Code Here

        final TestTailerListener listener = new TestTailerListener();
        final int delay = 100;
        final int idle = 50; // allow time for thread to work
        tailer = new Tailer(file, listener, delay, false);
        final Executor exec = new ScheduledThreadPoolExecutor(1);
        exec.execute(tailer);
        Thread.sleep(idle);
        tailer.stop();
        tailer=null;
        Thread.sleep(delay+idle);
        assertNull("Should not generate Exception", listener.exception);
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.