Examples of ThreadBoundReactor


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

        //Get a reference to the main thread.
        final Thread mainThread = Thread.currentThread();

        //Create a thread-bound processing.
        final ThreadBoundReactor reactor =
                new ThreadBoundReactor(new Runnable() {
                    @Override
                    public void run() {
                        //Interrupt the main thread when there are messages to process
                        mainThread.interrupt();
                    }
                });

        //Create an blades that uses the thread-bound processing.
        final SampleThreadBoundBlade threadBoundBlade = new SampleThreadBoundBlade(reactor);

        //Terminate the blades.
        new SOp<Void>("finBlade", threadBoundBlade.getReactor()) {
            @Override
            protected Void processSyncOperation(RequestImpl _requestImpl) throws Exception {
                threadBoundBlade.fin();
                return null;
            }
        }.signal();

        //Process messages when this thread is interrupted.
        while (true) {
            try {
                //Wait for an interrupt.
                Thread.sleep(60000);
            } catch (InterruptedException e) {
                //Process messages when the main thread is interrupted.
                reactor.run();
            }
        }
    }
View Full Code Here

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

public class ThreadBoundBladeBase extends BladeBase implements ThreadBoundBlade {
    /**
     * Create a Thread bound blade and a Thread bound reactor whose parent is the internal reactor of Plant.
     */
    public ThreadBoundBladeBase() throws Exception {
        _initialize(new ThreadBoundReactor());
    }
View Full Code Here

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

    ThreadBoundReactor reactor;

    public void testa() throws Exception {
        new Plant();
        try {
            reactor = new ThreadBoundReactor(new Runnable() {
                @Override
                public void run() {
                    reactor.run();
                    try {
                        Plant.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.