Package org.agilewiki.jactor2.core.reactors

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


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

public class PubSubSample {
    public static void main(final String[] args) throws Exception {
        final Plant plant = new Plant();
        try {
            NonBlockingReactor reactor = new NonBlockingReactor();
            RequestBus<String> requestBus =
                    new RequestBus<String>(reactor);
            new SubscribeAOp<String>(requestBus, reactor) {
                @Override
                protected void processContent(String _content) throws Exception {
                    System.out.println("got " + _content);
                }
            }.call();
            new SubscribeAOp<String>(requestBus, reactor, new EqualsFilter<String>("ribit")) {
                @Override
                protected void processContent(String _content, AsyncRequestImpl _asyncRequestImpl,
                                              AsyncResponseProcessor<Void> _asyncResponseProcessor)
                        throws Exception {
                    System.out.println("*** Ribit! ***");
                    _asyncResponseProcessor.processAsyncResponse(null);
                }
            }.call();
            System.out.println("\nPublishing null.");
            requestBus.sendsContentAOp(null).call();
            System.out.println("\nPublishing ribit");
            requestBus.sendsContentAOp("ribit").call();
            System.out.println("\nPublishing abc");
            requestBus.sendsContentAOp("abc").call();
        } finally {
            plant.close();
        }
    }
View Full Code Here


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

public class HungRequestTest extends CallTestBase {
    public void testa() throws Exception {
        new Plant();
        try {
            final Hanger blade1 = new Hanger(new NonBlockingReactor());
            try {
                call(blade1.hiAOp());
            } catch (final ReactorClosedException sce) {
View Full Code Here

import java.util.concurrent.atomic.AtomicInteger;

public class PubSubTest extends CallTestBase {
    public void testI() throws Exception {
        System.out.println("I");
        new Plant();
        try {
            final NonBlockingReactor reactor = new NonBlockingReactor();
            final RequestBus<Void> requestBus = new RequestBus<Void>(reactor);
            call(requestBus.signalsContentSOp(null));
            final Subscription<Void> s1 = call(new SubscribeAOp<Void>(
View Full Code Here

        }
    }

    public void testJ() throws Exception {
        System.out.println("J");
        new Plant();
        try {
            final AtomicInteger counter = new AtomicInteger();
            final NonBlockingReactor busReactor = new NonBlockingReactor();
            final CommonReactor subscriberReactor = new NonBlockingReactor();
            final RequestBus<Void> requestBus = new RequestBus<Void>(busReactor);
View Full Code Here

/**
* Test code.
*/
public class Test3 extends CallTestBase {
    public void testI() throws Exception {
        new Plant();
        final BladeC bladeC = new BladeC();
        final String result = call(bladeC.throwAOp());
        assertEquals("java.io.IOException: thrown on request", result);
        Plant.close();
    }
View Full Code Here

* Test code.
*/
@GwtIncompatible
public class Test1 extends CallTestBase {
    public void testI() throws Exception {
        new Plant();
        final Reactor reactor = new IsolationReactor();
        final BladeA bladeA = new BladeA(reactor);
        try {
            call(bladeA.throwAOp);
        } catch (final IOException se) {
View Full Code Here

import java.util.List;
import java.util.SortedMap;

public class TSSMTransactionTest extends CallTestBase {
    public void testI() throws Exception {
        new Plant();
        try {
            final TSSMReference<String> propertiesReference = new TSSMReference<String>();
            final CommonReactor reactor = new NonBlockingReactor();

            final RequestBus<TSSMChanges<String>> validationBus = propertiesReference.validationBus;
View Full Code Here

import org.agilewiki.jactor2.core.plant.DelayAOp;
import org.agilewiki.jactor2.core.requests.AsyncResponseProcessor;

public class AsyncTest extends CallTestBase {
    public void testI() throws Exception {
        new Plant();

        final AsyncTransaction<String, TransmutableString> addGood = new AsyncTransaction<String, TransmutableString>() {
            @Override
            protected void update(final TransmutableString transmutable,
                                  final AsyncResponseProcessor<Void> asyncResponseProcessor)
View Full Code Here

import java.io.IOException;

public class SyncTest extends CallTestBase {
    public void testI() throws Exception {
        new Plant();

        final SyncTransaction<String, TransmutableString> addGood =
                new SyncTransaction<String, TransmutableString>() {
            @Override
            protected void update(final TransmutableString transmutable)
View Full Code Here

import org.agilewiki.jactor2.core.impl.Plant;

public class FirehoseTest extends TestCase {
    public void test() throws Exception {
        System.gc();
        new Plant();
        try {
            DataProcessor next = new EndStage();
            next = new NullStage(next);
            next = new NullStage(next);
            next = new NullStage(next);
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.