Package com.sun.sgs.kernel

Examples of com.sun.sgs.kernel.RecurringTaskHandle


        handle.cancel();
    }

    @Test (expected=IllegalStateException.class)
        public void startAfterCancelRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            taskScheduler.scheduleRecurringTask(testTask, taskOwner,
                                                System.currentTimeMillis(),
                                                100);
        handle.cancel();
        handle.start();
    }
View Full Code Here


        public void addTaskRecurringNull() throws Exception {
        getQueueInstance().createRecurringTaskHandle(null);
    }

    @Test public void cancelAfterStartRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.start();
        handle.cancel();
    }
View Full Code Here

        handle.start();
        handle.cancel();
    }

    @Test public void startSleepAndCancelRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.start();
        Thread.sleep(200);
        handle.cancel();
    }
View Full Code Here

        Thread.sleep(200);
        handle.cancel();
    }

    @Test public void cancelRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.cancel();
    }
View Full Code Here

            getRecurringTask().getRecurringTaskHandle();
        handle.cancel();
    }

    @Test public void restartRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.start();
        try {
            handle.start();
            fail("Expected an IllegalStateException");
        } catch(IllegalStateException e) {}
        finally {
            // this is to make sure that the timer doesn't keep going
            handle.cancel();
        }
    }
View Full Code Here

        }
    }

    @Test (expected=IllegalStateException.class)
        public void recancelRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.cancel();
        handle.cancel();
    }
View Full Code Here

        handle.cancel();
    }

    @Test (expected=IllegalStateException.class)
        public void startAfterCancelRecurringTask() throws Exception {
        RecurringTaskHandle handle =
            getRecurringTask().getRecurringTaskHandle();
        handle.cancel();
        handle.start();
    }
View Full Code Here

        assertEquals(3, queue.getNextTasks(tasks, 3));
        assertEquals(2, queue.getNextTasks(tasks, 3));
    }

    @Test public void addAndConsumeTasksRecurring() throws Exception {
        RecurringTaskHandle handle1 =
            getRecurringTask().getRecurringTaskHandle();
        handle1.start();
        RecurringTaskHandle handle2 =
            getRecurringTask().getRecurringTaskHandle();
        handle2.cancel();
        RecurringTaskHandle handle3 =
            getRecurringTask().getRecurringTaskHandle();
        handle3.start();
        handle1.cancel();
        handle3.cancel();
        LinkedList<ScheduledTask> tasks = new LinkedList<ScheduledTask>();
        assertEquals(2, schedulerQueue.getNextTasks(tasks, 6));
        Thread.sleep(150);
        assertNull(schedulerQueue.getNextTask(false));
    }
View Full Code Here

        ScheduledTaskImpl scheduledTask = new ScheduledTaskImpl.Builder(
                task, owner, defaultPriority).
                startTime(startTime).
                period(period).
                build();
        RecurringTaskHandle handle =
            backingQueue.createRecurringTaskHandle(scheduledTask);
        scheduledTask.setRecurringTaskHandle(handle);
        return handle;
    }
View Full Code Here

        PendingTask ptask =
                (PendingTask) (dataService.createReferenceForId(objId).
                getForUpdate());
        ptask.setRunningNode(nodeId);

        RecurringTaskHandle handle =
            transactionScheduler.scheduleRecurringTask(
                runner, owner,
                watchdogService.getSystemTimeMillis(appStartTime), period);
        ctxFactory.joinTransaction().addRecurringTask(objId, handle, owner);
        return new PeriodicTaskHandleImpl(generateObjName(owner, objId));
View Full Code Here

TOP

Related Classes of com.sun.sgs.kernel.RecurringTaskHandle

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.