Examples of BaseChain


Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        task2.chain(task3);

       
        List<BaseChain> taskList = new ArrayList<BaseChain>();
        taskList.add(task1);
        taskList.add(task2);
        List<ClaimCheck> claims = manager.execute(taskList);
       
        boolean canceled = manager.cancel(claims.get(1));
        assertTrue("task2 report canceled true - Claim Check",canceled);
        assertEquals(TaskStatus.CANCELED,task2.getStatus());
        assertEquals(TaskStatus.CANCELED,task3.getStatus());
       
        stopWatch.block(500);
       
        //Cancel by UUID
        task1 = new TimerTask(500L);
        task2 = new TimerTask(500L);
        task3 = new TimerTask(500L);
        task2.chain(task3);
       
        taskList = new ArrayList<BaseChain>();
        taskList.add(task1);
        taskList.add(task2);
        claims = manager.execute(taskList);
       
        canceled = manager.cancel(UUID.fromString(claims.get(1).toString()));
        assertTrue("task2 report canceled true - UUID",canceled);
        assertEquals(TaskStatus.CANCELED,task2.getStatus());
        assertEquals(TaskStatus.CANCELED,task3.getStatus());
       
        stopWatch.block(500);
       
        //Cancel by UUID String
        task1 = new TimerTask(500L);
        task2 = new TimerTask(500L);
        task3 = new TimerTask(500L);
        task2.chain(task3);
       
        taskList = new ArrayList<BaseChain>();
        taskList.add(task1);
        taskList.add(task2);
        claims = manager.execute(taskList);
        canceled = manager.cancel(claims.get(1).toString());
        assertTrue("task2 report canceled true - UUID String",canceled);
        assertEquals(TaskStatus.CANCELED,task2.getStatus());
        assertEquals(TaskStatus.CANCELED,task3.getStatus());
       
        stopWatch.block(500);
       
        //Cancel by and do not queue
        task1 = new TimerTask(500L);
        task2 = new TimerTask(500L);
        task3 = new TimerTask(500L);
        task2.chain(task3);

       
        taskList = new ArrayList<BaseChain>();
        taskList.add(task1);
        taskList.add(task2);
        claims = manager.execute(taskList);
       
        stopWatch.block(700);
        canceled = manager.cancel(claims.get(1));
        assertTrue("task3 report canceled true",canceled);
        assertEquals(TaskStatus.WORKING,task2.getStatus());
        assertEquals(TaskStatus.DEQUEUED,task3.getStatus());
        stopWatch.block(1000);
        assertEquals(TaskStatus.SUCCESS,task2.getStatus());
        assertEquals(TaskStatus.CANCELED,task3.getStatus());
       
        //Does not cancel in-flight tasks
        task1 = new TimerTask(500L);
        task2 = new TimerTask(500L);
       
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

         manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel Stage by Task
        BaseChain task0 = new TimerTask(500L);
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        task2.chain(task3);

        Stage stage1 = new Stage();
        stage1.stage(task1);
        Stage stage2 = new Stage();
        stage2.stage(task2);
        stage2.stage(task4);
        stage1.chain(stage2);
       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task0);
        taskList.add(stage1);
        List<ClaimCheck> claims = manager.execute(taskList);
       
        // Give it time to proccess MeanwhileThreadPoolExecutor.beforeExecute()
        stopWatch.block(600);
        boolean canceled = manager.cancel(claims.get(1));
        assertTrue("Task 2 canceled = true within Stage",canceled);
        assertEquals("Task 2 status CANCELED within Stage",TaskStatus.DEQUEUED,task2.getStatus());
        assertEquals("Task 3 status CANCELED within Stage",TaskStatus.DEQUEUED,task3.getStatus());
        // Wait for all tasks and stages to complete
        stopWatch.block(2000);
        assertEquals("Task 2 status CANCELED within Stage - post all finish",TaskStatus.CANCELED,task2.getStatus());
        assertEquals("Task 3 status CANCELED within Stage",TaskStatus.CANCELED,task3.getStatus());
        assertEquals("Task 4 status SUCCCESS within Stage",TaskStatus.CANCELED,task4.getStatus());
        assertEquals("Task 0 status SUCCESS outside of stage",TaskStatus.SUCCESS,task0.getStatus());
        assertEquals("Task 1 status SUCCESS within Stage",TaskStatus.SUCCESS,task1.getStatus());
        assertEquals("Stage 1 status SUCCESS within Stage",TaskStatus.SUCCESS,stage1.getStatus());
        assertEquals("Stage 2 status SUCCESS within Stage",TaskStatus.CANCELED,stage2.getStatus());
    }
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

         manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        task2.chain(task3);

       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task1);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumStagePoolThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        BaseChain task5 = new TimerTask(500L);
        task2.chain(task3);
        Stage stage1 = new Stage();
        stage1.stage(task1);
        Stage stage2 = new Stage();
        stage2.stage(task2);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

         manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        task2.chain(task3);

       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task1);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumThreadCount(1);
        manager.setMaximumStagePoolThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        BaseChain task5 = new TimerTask(500L);
        task2.chain(task3);
        Stage stage1 = new Stage();
        stage1.stage(task1);
        Stage stage2 = new Stage();
        stage2.stage(task2);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

         manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        task2.chain(task3);

       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task1);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumStagePoolThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(2000);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        BaseChain task5 = new TimerTask(500L);
        task2.chain(task3);
        Stage stage1 = new Stage();
        stage1.stage(task1);
        Stage stage2 = new Stage();
        stage2.stage(task2);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumThreadCount(1);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(500L);
        BaseChain task2 = new TimerTask(500L);
        BaseChain task3 = new TimerTask(500L);
        BaseChain task4 = new TimerTask(500L);
        task2.chain(task3);

       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task1);
View Full Code Here

Examples of com.level3.meanwhile.base.BaseChain

        manager.setMaximumThreadCount(3);
        //Allow some time to bring the thread count back down
        stopWatch.block(500);
       
        //Cancel by Task
        BaseChain task1 = new TimerTask(1000L);
        BaseChain task2 = new TimerTask(1000L);
        BaseChain task3 = new TimerTask(1000L);
        BaseChain task4 = new TimerTask(1000L);
        BaseChain task5 = new TimerTask(1000L);
        task2.chain(task3);

       
        List<Task> taskList = new ArrayList<Task>();
        taskList.add(task1);
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.