Package org.agilewiki.jactor2.core.blades

Examples of org.agilewiki.jactor2.core.blades.NamedBlade


    }

    public void test4() throws Exception {
        Thread.sleep(100);
        System.err.println("\ntest 4");
        new Plant();
        try {
            Foot foot = new Foot(new IsolationReactor());
            Via via = new Via(foot.dAOp());
            Head head = new Head(via.dAOp());
            System.err.println("skipping this test");
View Full Code Here


    }

    public void test5() throws Exception {
        Thread.sleep(100);
        System.err.println("\ntest 5");
        new Plant();
        try {
            IsolationReactor reactor = new IsolationReactor();
            Foot foot = new Foot(reactor);
            Via via = new Via(foot.dAOp());
            Head head = new Head(via.dAOp(), reactor);
View Full Code Here

    }

    public void test6() throws Exception {
        Thread.sleep(100);
        System.err.println("\ntest 6");
        new Plant();
        try {
            IsolationReactor reactor = new IsolationReactor();
            Foot foot = new Foot(reactor);
            Head head = new Head(foot.dAOp(), reactor);
            assertTrue(call(head.dAOp()));
View Full Code Here

*/
public class CloseableSetTest extends TestCase {

    public void testReactor() throws Exception {
        System.out.println("R");
        new Plant();
        try {
            final Reactor reactor = new NonBlockingReactor();

            final MyCloseable mac1 = new MyCloseable();
            final MyCloseable mac2 = new MyCloseable();
View Full Code Here

     * @param _initialLocalQueueSize The initial size of the local queue.
     */
    public ReactorMtImpl(final NonBlockingReactor _parentReactor,
            final int _initialBufferSize, final int _initialLocalQueueSize) {
        closeableImpl = new CloseableImplImpl(this);
        final PlantConfiguration plantConfiguration = PlantMtImpl
                .getSingleton().getPlantConfiguration();
        @SuppressWarnings("resource")
        final NonBlockingReactorMtImpl parentReactorImpl = _parentReactor == null ? null
                : (NonBlockingReactorMtImpl) _parentReactor.asReactorImpl();
        recovery = _parentReactor == null ? plantConfiguration.getRecovery()
                : parentReactorImpl.getRecovery();
        plantScheduler = _parentReactor == null ? plantConfiguration
                .getPlantScheduler() : parentReactorImpl.getPlantScheduler();
        initialBufferSize = _initialBufferSize;
        initialLocalQueueSize = _initialLocalQueueSize;
        parentReactor = _parentReactor;
        logger = LoggerFactory.getLogger(Reactor.class);
View Full Code Here

    /**
     * Create a plant with the default configuration.
     */
    public Plant() throws Exception {
        new PlantMtImpl();
    }
View Full Code Here

     *
     * @param _reactorThreadPoolSize The number of threads to be created for the
     *                               reactor thread pool.
     */
    public Plant(final int _reactorThreadPoolSize) throws Exception {
        new PlantMtImpl(_reactorThreadPoolSize);
    }
View Full Code Here

     * Create a plant with the given configuration.
     *
     * @param _plantConfiguration The configuration to be used by the plant.
     */
    public Plant(final PlantConfiguration _plantConfiguration) throws Exception {
        new PlantMtImpl(_plantConfiguration);
    }
View Full Code Here

            }
        }

        shuttingDown = true;

        final PlantMtImpl plantImpl = PlantMtImpl.getSingleton();
        if ((plantImpl != null) && isRunning()
                && ((currentRequest == null) || !currentRequest.isComplete())) {
            timeoutSemaphore = plantImpl.schedulableSemaphore(recovery
                    .getThreadInterruptMillis(this));
            final Thread thread = getThreadReference().get();
            if (thread != null) {
                thread.interrupt();
                boolean timeout = false;
View Full Code Here

                final ReactorPoolThread currentThread = (ReactorPoolThread) Thread
                        .currentThread();
                while (true) {
                    try {
                        taskRequest.acquire();
                        PoolThreadReactorMtImpl reactor = reactors.poll();
                        if (reactor != null) {
                            AtomicReference<Thread> threadReference = reactor
                                    .getThreadReference();
                            if ((threadReference.get() == null)
                                    && threadReference.compareAndSet(null,
                                            currentThread)) {
                                currentThread.setCurrentReactor(reactor);
                                while (true) {
                                    try {
                                        reactor.run();
                                    } catch (final MigrationException me) {
                                        final boolean hasWork = reactor
                                                .hasWork();
                                        threadReference.set(null);
                                        if (reactor.isIdler() || hasWork
                                                || reactor.hasConcurrent()) {
                                            execute(reactor);
                                        }
                                        reactor = me.reactor;
                                        threadReference = reactor
                                                .getThreadReference();
                                        currentThread
                                                .setCurrentReactor(reactor);
                                        continue;
                                    } catch (final Throwable e) {
                                        logger.error(
                                                "Exception thrown by a targetReactor's run method",
                                                e);
                                    }
                                    final boolean hasWork = reactor.hasWork();
                                    threadReference.set(null);
                                    if (hasWork || reactor.hasConcurrent()) {
                                        execute(reactor);
                                    }
                                    break;
                                }
                                currentThread.setCurrentReactor(null);
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor2.core.blades.NamedBlade

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.