Package com.sun.sgs.app

Examples of com.sun.sgs.app.Task


                CellDescription cell = processList.remove(0);
                processCell(cell);
            }
           
            // figure out the next task
            Task next;
            if (!processList.isEmpty()) {
                // still ids to process
                next = new CellResourcesTask(processList, cells, rm, task);
            } else {
                // all done -- perform task
View Full Code Here


            this.tasksRef = tasksRef;
        }

        public void run() throws Exception {
            // get the first task
            Task task = tasksRef.get().remove();

            // run it
            task.run();

            // schedule the next task
            if (tasksRef.get().isEmpty()) {
                // we are all done -- call cleanup logout
                UserManager.getUserManager().cleanupClient(clientID);
View Full Code Here

     * task and run it, throwing any exceptions raised by the task. Note
     * that if {@code isTaskAvailable} returns {@code false} then this
     * method will simply return without running anything.
     */
    void run() throws Exception {
        Task actualTask = null;
        try {
            actualTask = (task != null) ? task : taskRef.get();
        } catch (ObjectNotFoundException onfe) {
            // This only happens when the application removed the task
            // object but didn't cancel the task, so we're done
            return;
        }
        actualTask.run();
    }
View Full Code Here

     * task and run it, throwing any exceptions raised by the task. Note
     * that if {@code isTaskAvailable} returns {@code false} then this
     * method will simply return without running anything.
     */
    void run() throws Exception {
        Task actualTask = null;
        try {
            actualTask = (task != null) ? task : taskRef.get();
        } catch (ObjectNotFoundException onfe) {
            // This only happens when the application removed the task
            // object but didn't cancel the task, so we're done
            return;
        }
        actualTask.run();
    }
View Full Code Here

    @Test
    public void testScheduleTaskNotSerializable() throws Exception {
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() {
                    Task task = new NonSerializableTask();
                    try {
                        taskService.scheduleTask(task);
                        fail("Expected IllegalArgumentException");
                    } catch (IllegalArgumentException e) {
                        System.err.println(e);
View Full Code Here

    @Test
    public void testScheduleTaskNotManagedObject() throws Exception {
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() {
                    Task task = new NonManagedTask(taskOwner);
                    try {
                        taskService.scheduleTask(task);
                    } catch (Exception e) {
                        fail("Did not expect Exception: " + e);
                    }
View Full Code Here

    @Test
    public void testScheduleTaskIsManagedObject() throws Exception {
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() {
                    Task task = new ManagedTask();
                    try {
                        taskService.scheduleTask(task);
                    } catch (Exception e) {
                        fail("Did not expect Exception: " + e);
                    }
View Full Code Here

    @Test
    public void testScheduleNegativeTime() throws Exception {
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() {
                    Task task = new ManagedTask();
                    try {
                        taskService.scheduleTask(task, -1L);
                        fail("Expected IllegalArgumentException");
                    } catch (IllegalArgumentException e) {
                        System.err.println(e);
View Full Code Here

        }, taskOwner);
    }

    @Test
    public void testScheduleTaskNoTransaction() {
        Task task = new ManagedTask();
        try {
            taskService.scheduleTask(task);
            fail("Expected TransactionNotActiveException");
        } catch (TransactionNotActiveException e) {
            System.err.println(e);
View Full Code Here

    @Test
    public void testScheduleTaskNotSerializable() throws Exception {
        txnScheduler.runTask(
            new TestAbstractKernelRunnable() {
                public void run() {
                    Task task = new NonSerializableTask();
                    try {
                        taskService.scheduleTask(task);
                        fail("Expected IllegalArgumentException");
                    } catch (IllegalArgumentException e) {
                        System.err.println(e);
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.Task

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.