Package org.agilewiki.jactor.concurrent

Examples of org.agilewiki.jactor.concurrent.ThreadManager


        //int c = 1000000;
        //int b = 1;
        //int p = 16;
        //int t = 4;

        ThreadManager threadManager = JAThreadManager.newThreadManager(t);
        try {
            Driver driver = new Driver(threadManager, c, b, p);
            JABufferedEventsFuture<Object> eventFuture = new JABufferedEventsFuture<Object>();
            eventFuture.send(driver, eventFuture);
            eventFuture.send(driver, eventFuture);
            long t0 = System.currentTimeMillis();
            eventFuture.send(driver, eventFuture);
            long t1 = System.currentTimeMillis();
            System.out.println("" + p + " parallel runs of " + (2 * c * b) + " messages each.");
            System.out.println("" + (p * 2 * c * b + 2 * p) + " messages sent with " + t + " threads.");
            if (t1 != t0)
                System.out.println("msgs per sec = " + ((c * b * p * 2L + 2L * p) * 1000L / (t1 - t0)));
        } finally {
            threadManager.close();
        }

        //burst size of 1000
        //4 parallel runs of 200000000 messages each.
        //800000008 messages sent with 4 threads.
View Full Code Here


/**
* Test code.
*/
final public class QuadTest extends TestCase {
    public void testTiming() {
        ThreadManager threadManager = JAThreadManager.newThreadManager(8);
        try {
            Driver driver = new Driver(threadManager, 10, new Echo(threadManager));
            JAEventFuture<Object> eventFuture = new JAEventFuture<Object>();
            int i = 0;
            while (i < 10) {
                eventFuture.send(driver, eventFuture);
                i += 1;
            }
        } finally {
            threadManager.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor.concurrent.ThreadManager

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.