Package org.apache.geronimo.pool

Examples of org.apache.geronimo.pool.ThreadPool


    private Object userKey = "test user info";

    protected void setUp() throws Exception {
        userTaskFactory = new MockUserTaskFactory();
        threadPool = new ThreadPool();
        threadPool.setPoolSize(30);
        threadPool.setKeepAliveTime(10000);
        threadPool.setPoolName("TestPool");
        threadPool.doStart();
        WorkerPersistence workerPersistence = new VMWorkerPersistence();
View Full Code Here


    private Object userKey = "test user info";

    protected void setUp() throws Exception {
        userTaskFactory = new MockUserTaskFactory();
        threadPool = new ThreadPool(30, 30, "TestPool", 10000, this.getClass().getClassLoader(), "foo:bar=baz");
        WorkerPersistence workerPersistence = new VMWorkerPersistence();
        timer = new ThreadPooledTimer(executableWorkFactory, workerPersistence, threadPool, transactionManager);
        timer.doStart();

        counter.set(0);
View Full Code Here

        // Don't init if allready done.
        if (threadPool != null) {
            return;
        }

        threadPool = new ThreadPool();
        threadPool.setKeepAliveTime(1 * 1000);
        threadPool.setPoolSize(5);
        threadPool.setPoolName("C Pool");

        clockPool = new ClockPool();
View Full Code Here

    private Object userKey = "test user info";

    protected void setUp() throws Exception {
        userTaskFactory = new MockUserTaskFactory();
        threadPool = new ThreadPool(30, "TestPool", 10000, this.getClass().getClassLoader(), "foo:bar=baz");
        WorkerPersistence workerPersistence = new VMWorkerPersistence();
        timer = new ThreadPooledTimer(executableWorkFactory, workerPersistence, threadPool, transactionContextManager);
        timer.doStart();

        counter.set(0);
View Full Code Here

        // Don't init if allready done.
        if (threadPool != null) {
            return;
        }

        threadPool = new ThreadPool();
        threadPool.setKeepAliveTime(1 * 1000);
        threadPool.setPoolSize(5);
        threadPool.setPoolName("S Pool");

        clockPool = new ClockPool();
View Full Code Here

        // Don't init if allready done.
        if (threadPool != null) {
            return;
        }

        threadPool = new ThreadPool();
        threadPool.setKeepAliveTime(1 * 1000);
        threadPool.setPoolSize(5);
        threadPool.setPoolName("C Pool");

        clockPool = new ClockPool();
View Full Code Here

        private SelectorManager sm;
        public MessagingTransportFactory factoryTransport() {
            return new NetworkTransportFactory(sm, cp);
        }
        public void init(String aName) throws Exception {
            tp = new ThreadPool();
            tp.setKeepAliveTime(1 * 1000);
            tp.setPoolSize(10);
            tp.setPoolName("TP " + aName);

            cp = new ClockPool();
View Full Code Here

    }

    class ClientAction implements PrivilegedExceptionAction {

        public Object run() throws Exception {
            ThreadPool tp = new ThreadPool();
            tp.setKeepAliveTime(1 * 1000);
            tp.setPoolSize(1);
            tp.setPoolName("Client TP");
            tp.doStart();

            ClockPool cp = new ClockPool();
            cp.setPoolName("Client CP");
            cp.doStart();

            SelectorManager sm = new SelectorManager();
            sm.setThreadPool(tp);
            sm.setThreadName("Client Selector Manager");
            sm.doStart();

            ControlClientProtocolStack clientStack = new ControlClientProtocolStack();
            clientStack.setClassLoader(Thread.currentThread().getContextClassLoader());
            clientStack.setThreadPool(tp);
            clientStack.setClockPool(cp);
            clientStack.setSelectorManager(sm);

            SocketProtocol sp = new SocketProtocol();
            sp.setTimeout(1000 * 1000); //todo reset to 10s
            sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
            sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
            sp.setSelectorManager(sm);

            clientStack.push(sp);

            ControlClientProtocol ccp = new ControlClientProtocol();
            ccp.setTimeout(1000 * 1000); //todo set to 10s

            clientStack.push(ccp);

            clientStack.setup();

            clientStack.sendDown(getPlainPacket());
            clientStack.sendDown(getPlainPacket());
            clientStack.sendDown(getPlainPacket());

            Thread.sleep(5 * 1000);

            clientStack.drain();

            shutdownLatch.release();

            sm.doStop();

            cp.doStop();

            tp.doStop();

            stopLatch.release();

            return null;
        }
View Full Code Here

    }

    class ServerAction implements PrivilegedExceptionAction {

        public Object run() throws Exception {
            ThreadPool tp = new ThreadPool();
            tp.setKeepAliveTime(1 * 1000);
            tp.setPoolSize(1);
            tp.setPoolName("Server TP");
            tp.doStart();

            ClockPool cp = new ClockPool();
            cp.setPoolName("Server CP");
            cp.doStart();

            SelectorManager sm = new SelectorManager();
            sm.setThreadPool(tp);
            sm.setThreadName("Server Selector Manager");
            sm.doStart();

            ControlServerProtocolStack templateStack = new ControlServerProtocolStack();

            SocketProtocol spt = new SocketProtocol();
            spt.setTimeout(10 * 1000);
            spt.setSelectorManager(sm);

            templateStack.push(spt);

            ControlServerProtocol csp = new ControlServerProtocol();
            csp.setTimeout(1 * 1000);
            csp.setThreadPool(tp);
            csp.setClockPool(cp);
            csp.setSelectorManager(sm);
            csp.setControlServerListener(new ControlServerListener() {
                public void shutdown() {
                    log.trace("SERVER SIDE SHUTDOWN");
                }
            });

            templateStack.push(csp);

            ControlServerProtocolWaiter waiter = new ControlServerProtocolWaiter();

            SubjectCarryingServerProtocol scp = new SubjectCarryingServerProtocol();

            waiter.push(scp);

            waiter.push(new CountingProtocol());

            TestProtocol test = new TestProtocol();
            test.setValue("SimpleTest");
            test.setThreadPool(tp);
            test.setClockPool(cp);
            test.setSelectorManager(sm);

            waiter.push(test);

            templateStack.push(waiter);

            ProtocolFactory pf = new ProtocolFactory();
            pf.setClockPool(cp);
            pf.setMaxAge(Long.MAX_VALUE);
            pf.setMaxInactivity(1 * 60 * 60 * 1000);
            pf.setReclaimPeriod(10 * 1000);
            pf.setTemplate(templateStack);

            ssa = new ServerSocketAcceptor();
            ssa.setSelectorManager(sm);
            ssa.setTimeOut(5 * 1000);
            ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
            ssa.setAcceptorListener(pf);
            ssa.startup();

            startLatch.release();

            shutdownLatch.acquire();

            ssa.drain();

            pf.drain();

            sm.doStop();

            cp.doStop();

            tp.doStop();

            return null;
        }
View Full Code Here

    }

    class ClientAction implements PrivilegedExceptionAction {

        public Object run() throws Exception {
            ThreadPool tp = new ThreadPool();
            tp.setKeepAliveTime(1 * 1000);
            tp.setPoolSize(5);
            tp.setPoolName("Client TP");
            tp.doStart();

            ClockPool cp = new ClockPool();
            cp.setPoolName("Client CP");
            cp.doStart();

            SelectorManager sm = new SelectorManager();
            sm.setThreadPool(tp);
            sm.setThreadName("Client Selector Manager");
            sm.doStart();

            ControlClientProtocolStack clientStack = new ControlClientProtocolStack();
            clientStack.setClassLoader(Thread.currentThread().getContextClassLoader());
            clientStack.setThreadPool(tp);
            clientStack.setClockPool(cp);
            clientStack.setSelectorManager(sm);

            SocketProtocol sp = new SocketProtocol();
            sp.setTimeout(1000 * 1000); //todo reset to 10s
            sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
            sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
            sp.setSelectorManager(sm);

            clientStack.push(sp);

            ControlClientProtocol ccp = new ControlClientProtocol();
            ccp.setTimeout(1000 * 1000); //todo set to 10s

            clientStack.push(ccp);

            clientStack.setup();
            Thread.sleep(5 * 1000); //todo delete

            clientStack.sendDown(getPlainPacket());
            clientStack.sendDown(getPlainPacket());
            clientStack.sendDown(getPlainPacket());

            Thread.sleep(5 * 1000); //todo back to 5s

            clientStack.drain();

            shutdownLatch.release();

            sm.doStop();

            cp.doStop();

            tp.doStop();

            stopLatch.release();

            return null;
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.pool.ThreadPool

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.