Package com.sun.sgs.kernel

Examples of com.sun.sgs.kernel.TaskReservation


        }

        // reserve a space for this task
        try {
            TxnState txnState = ctxFactory.joinTransaction();
            TaskReservation res = null;
            // see if this should be scheduled as a task to run now, or as
            // a task to run after a delay, and which scheduler to use
            if (startTime == START_NOW) {
                if (transactional) {
                    res = transactionScheduler.reserveTask(task, owner);
View Full Code Here


                               "newNode: {1}}",
                               id, newNode);
                    for (NodeMappingListener listener :
                         nodeChangeListeners)
                    {    
                        TaskReservation res =
                            taskScheduler.reserveTask(
                                new MapRemoveTask(listener, id, newNode),
                                taskOwner);
                        pendingNotifications.add(res);
                    }
View Full Code Here

                               "identity: {0}, " + "oldNode: {1}}",
                               id, oldNode);
                    for (NodeMappingListener listener :
                         nodeChangeListeners)
                    {
                        TaskReservation res =
                            taskScheduler.reserveTask(
                                new MapAddTask(listener, id, oldNode),
                                taskOwner);
                        pendingNotifications.add(res);
                    }
View Full Code Here

                               "newNode: {1}}",
                               id, newNode);
                    for (NodeMappingListener listener :
                         nodeChangeListeners)
                    {    
                        TaskReservation res =
                            taskScheduler.reserveTask(
                                new MapRemoveTask(listener, id, newNode),
                                taskOwner);
                        pendingNotifications.add(res);
                    }
View Full Code Here

                               "identity: {0}, " + "oldNode: {1}}",
                               id, oldNode);
                    for (NodeMappingListener listener :
                         nodeChangeListeners)
                    {
                        TaskReservation res =
                            taskScheduler.reserveTask(
                                new MapAddTask(listener, id, oldNode),
                                taskOwner);
                        pendingNotifications.add(res);
                    }
View Full Code Here

                         idRelocationListeners)
                    {
                        final SimpleCompletionHandler handler =
                            new PrepareMoveCompletionHandler(id);
                        handlerQueue.add(handler);
                        TaskReservation res =
                            taskScheduler.reserveTask(
                                new MapRelocateTask(listener, id, newNodeId,
                                                    handler),
                                taskOwner);
                        pendingNotifications.add(res);
View Full Code Here

        reservation.cancel();
    }

    @Test (expected=IllegalStateException.class)
        public void useAfterCancelReservedTask() throws Exception {
        TaskReservation reservation =
            taskScheduler.reserveTask(testTask, taskOwner);
        reservation.cancel();
        reservation.use();
    }
View Full Code Here

        reservation.use();
    }

    @Test (expected=IllegalStateException.class)
        public void useAfterCancelReservedTaskDelayed() throws Exception {
        TaskReservation reservation =
            taskScheduler.reserveTask(testTask, taskOwner,
                                      System.currentTimeMillis() + 50);
        reservation.cancel();
        reservation.use();
    }
View Full Code Here

        }

        // reserve a space for this task
        try {
            TxnState txnState = ctxFactory.joinTransaction();
            TaskReservation res = null;
            // see if this should be scheduled as a task to run now, or as
            // a task to run after a delay, and which scheduler to use
            if (appStartTime == START_NOW) {
                if (transactional) {
                    res = transactionScheduler.reserveTask(task, owner);
View Full Code Here

        taskScheduler.reserveTask(testTask, taskOwner,
                                  System.currentTimeMillis() - 50);
    }

    @Test public void useReservedTask() throws Exception {
        TaskReservation reservation =
            taskScheduler.reserveTask(new IncrementRunner(), taskOwner);
        reservation.use();
        Thread.sleep(200L);
        assertEquals(1, taskCount);
    }
View Full Code Here

TOP

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

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.