Package com.sun.sgs.kernel.schedule

Examples of com.sun.sgs.kernel.schedule.ScheduledTask


     * {@inheritDoc}
     */
    public ScheduledTask getNextTask(boolean wait)
        throws InterruptedException
    {
        ScheduledTask task = queue.poll();
        if ((task != null) || (!wait)) {
            return task;
        }
        return queue.take();
    }
View Full Code Here


        queue.reserveTask(testTask);
    }

    @Test public void reserveTasksDelayed() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        ScheduledTask delayedTask = new ScheduledTaskImpl(testTask, 100);
        queue.reserveTask(delayedTask);
        queue.reserveTask(delayedTask);
        queue.reserveTask(delayedTask);
        queue.reserveTask(delayedTask);
        queue.reserveTask(delayedTask);
View Full Code Here

        queue.addTask(testTask);
    }

    @Test public void addTasksDelayed() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        ScheduledTask delayedTask = new ScheduledTaskImpl(testTask, 100);
        queue.addTask(delayedTask);
        queue.addTask(delayedTask);
        queue.addTask(delayedTask);
        queue.addTask(delayedTask);
        queue.addTask(delayedTask);
View Full Code Here

     * Add and consume correctness tests.
     */

    @Test public void addAndConsumeTask() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        ScheduledTask task = new ScheduledTaskImpl();
        queue.addTask(task);
        assertEquals(task, queue.getNextTask(false));
    }
View Full Code Here

        assertNull(queue.getNextTask(false));
    }

    @Test public void addAndConsumeTaskDelayed() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        ScheduledTask task = new ScheduledTaskImpl(100);
        queue.addTask(task);
        assertNull(queue.getNextTask(false));
        Thread.sleep(200);
        assertEquals(task, queue.getNextTask(false));
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.kernel.schedule.ScheduledTask

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.