Package org.agilewiki.jactor2.core.reactors

Examples of org.agilewiki.jactor2.core.reactors.ThreadBoundReactor


                    }
                };

        try {
            TransmutableReference<String, TransmutableString> t =
                    new TransmutableReference<String, TransmutableString>(new TransmutableString("fun"));
            System.out.println(t.getUnmodifiable()); // fun
            call(t.applyAOp(addGood));
            System.out.println(t.getUnmodifiable()); // good fun
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // good fun
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("grapes"));
            System.out.println(t.getUnmodifiable()); // grapes
            call(t.applyAOp(addMoreGood));
            System.out.println(t.getUnmodifiable()); // more good grapes
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // more good grapes
View Full Code Here


                    }
                };

        try {
            TransmutableReference<String, TransmutableString> t =
                    new TransmutableReference<String, TransmutableString>(new TransmutableString("fun"));
            System.out.println(t.getUnmodifiable()); // fun
            call(t.applyAOp(addGood));
            System.out.println(t.getUnmodifiable()); // good fun
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // good fun
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("grapes"));
            System.out.println(t.getUnmodifiable()); // grapes
            call(t.applyAOp(addMoreGood));
            System.out.println(t.getUnmodifiable()); // more good grapes
            call(t.applyAOp(noop));
            System.out.println(t.getUnmodifiable()); // more good grapes
            t = new TransmutableReference<String, TransmutableString>(new TransmutableString("times"));
            System.out.println(t.getUnmodifiable()); // times
            try {
                call(t.applyAOp(bogus));
            } catch (final Exception e) {
                System.out.println("*** " + e);
View Full Code Here

            assertEquals("no way", msg);
            assertEquals(1, immutableState.size());
            immutableState = propertiesReference.getUnmodifiable();
            assertEquals(1, immutableState.size());

            TSSMUpdateTransaction ut = new TSSMUpdateTransaction<String>("1", (String) null);
            call(propertiesReference.applyAOp(ut));
            System.out.println(ut);
            immutableState = propertiesReference.getUnmodifiable();
            assertEquals(0, immutableState.size());
        } finally {
View Full Code Here

        if (closeables != null) {
            final HashSet<Closeable> hs = new HashSet<Closeable>(closeables);
            Iterator<Closeable> cit = hs.iterator();
            while (cit.hasNext()) {
                final Closeable closeable = cit.next();
                try {
                    closeable.close();
                } catch (final Throwable t) {
                    if ((closeable != null) && PlantMtImpl.DEBUG) {
                        getLogger().warn(
                                "Error closing a "
                                        + closeable.getClass().getName(), t);
                    }
                }
            }
            cit = closeables.iterator();
            while (cit.hasNext()) {
                final Closeable closeable = cit.next();
                warn("still has closable: " + this + "\n" + closeable);
            }
        }

        shuttingDown = true;
View Full Code Here

                recovery.onMessageTimeout(this);
            }
        }
        final Iterator<Closeable> it = getCloseableSet().iterator();
        while (it.hasNext()) {
            final Closeable closeable = it.next();
            if (!(closeable instanceof ReactorMtImpl)) {
                continue;
            }
            final ReactorMtImpl reactor = (ReactorMtImpl) closeable;
            reactor.reactorPoll();
View Full Code Here

class MyCloseable implements Closeable {
    public volatile int closed;
    CloseableImpl closeableImpl;

    MyCloseable() throws Exception {
        closeableImpl = new CloseableImplImpl(this);
    }
View Full Code Here

     * @param _initialBufferSize     The initial size of a send buffer.
     * @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();
View Full Code Here

                _targetReactor);
    }

    @Override
    public CloseableImpl createCloseableImpl(final Closeable _closeable) {
        return new CloseableImplImpl(_closeable);
    }
View Full Code Here

import org.agilewiki.jactor2.core.requests.ExceptionHandler;
import org.agilewiki.jactor2.core.requests.impl.AsyncRequestImpl;

public class AnyMain {
    public static void main(final String[] _args) throws Exception {
        new Plant();
        try {
            System.out.println("\ntest 1");
            long x = new Any<Long>(new A2("1", 1), new A2("2", 2), new A2("3",
                    3)).call();
            System.out.println("got " + x);
View Full Code Here

        };
    }

    public static void main(final String[] _args) throws Exception {
        final long count = 10000L;
        new Plant(10);
        try {
            final Delays delays = new Delays(count);
            final AOp<Void> runAReq = delays.runAOp();
            final long before = System.currentTimeMillis();
            runAReq.call();
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor2.core.reactors.ThreadBoundReactor

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.