Package com.sun.sgs.kernel.schedule

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


     * Test scale through number of tasks and number of threads.
     */

    @Test (timeout=1000)
        public void addAndConsumeManyTasks() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        for (int i = 0; i < 537; i++)
            queue.addTask(new ScheduledTaskImpl(50));
        for (int i = 0; i < 679; i++)
            queue.addTask(new ScheduledTaskImpl());
        int count = 0;
        while (queue.getNextTask(false) != null)
            count++;
        Thread.sleep(100);
        while (queue.getNextTask(false) != null)
            count++;
        assertEquals(1216, count);
    }
View Full Code Here


        assertEquals(1216, count);
    }

    @Test (timeout=5000)
        public void fewThreadsFewTasks() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        Runnable [] r = new Runnable[4];
        r[0] = new ProducerRunnable(queue, 1);
        r[1] = new ProducerRunnable(queue, 10);
        r[2] = new ConsumerRunnable(queue, 4);
        r[3] = new ConsumerRunnable(queue, 7);
View Full Code Here

        assertEquals(0, threadGroup.getFailureCount());
    }

    @Test (timeout=5000)
        public void manyThreadsFewTasks() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        Runnable [] r = new Runnable[128];
        for (int i = 0; i < 64; i++)
            r[i] = new ProducerRunnable(queue, 4);
        for (int i = 64; i < 128; i++)
            r[i] = new ConsumerRunnable(queue, 4);
View Full Code Here

        assertEquals(0, threadGroup.getFailureCount());
    }

    @Test (timeout=5000)
        public void fewThreadsManyTasks() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        Runnable [] r = new Runnable[4];
        r[0] = new ProducerRunnable(queue, 674);
        r[1] = new ProducerRunnable(queue, 458);
        r[2] = new ConsumerRunnable(queue, 539);
        r[3] = new ConsumerRunnable(queue, 593);
View Full Code Here

        assertEquals(0, threadGroup.getFailureCount());
    }

    @Test (timeout=5000)
        public void manyThreadsManyTasks() throws Exception {
        SchedulerQueue queue = getQueueInstance();
        Runnable [] r = new Runnable[128];
        for (int i = 0; i < 64; i++)
            r[i] = new ProducerRunnable(queue, 83);
        for (int i = 64; i < 128; i++)
            r[i] = new ConsumerRunnable(queue, 83);
View Full Code Here

TOP

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

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.