Package org.agilewiki.jactor

Examples of org.agilewiki.jactor.RP


public class Factorial extends JLPCActor implements SimpleRequestReceiver {
    @Override
    public void processRequest(SimpleRequest req, final RP rp)
            throws Exception {
        final int max = 5;
        RP printResult = new RP() {
            public void processResponse(Object rsp) throws Exception {
                System.out.println(rsp);
                rp.processResponse(null);
            }
        };
        final Multiplier mp = new Multiplier();
        mp.initialize(getMailbox());
        (new JAIterator() {
            int i;
            int r = 1;

            public void process(RP rp) throws Exception {
                if (i >= max) rp.processResponse(new Integer(r));
                else {
                    i += 1;
                    Multiply m = new Multiply();
                    m.a = r;
                    m.b = i;
                    send(mp, m, new RP() {
                        public void processResponse(Object rsp) throws Exception {
                            r = ((Integer) rsp).intValue();
                        }
                    });
                    rp.processResponse(null);
View Full Code Here


            @Override
            public void processResponse(Actor response) throws Exception {
                Evaluator evaluator = (Evaluator) response;
                Eval eval = new Eval(block.getTimestamp());
                if (generateCheckpoints) {
                    RP evalrp = new RP() {
                        @Override
                        public void processResponse(Object response) throws Exception {
                            Checkpoint checkpoint = new Checkpoint(
                                    block.getCurrentPosition(),
                                    block.getTimestamp(), block.getFileName());
View Full Code Here

            return;
        responsePending = true;
        ProcessBlock req = pendingRequest;
        pendingRequest = null;
        if (req.block instanceof FBlock) {
            final RP rp = _rp;
            _rp = null;
            Finish.req.send(this, next, new RP<Object>() {
                @Override
                public void processResponse(Object response) throws Exception {
                    responsePending = false;
                    rp.processResponse(null);
                    nextSend();
                }
            });
        } else {
            _rp.processResponse(null);
View Full Code Here

    private void eval(final Eval req)
            throws Exception {
        final ArrayList<Evaluator> evaluators = new ArrayList<Evaluator>(size());
        while (true) {
            if (ndx == size()) {
                RP rp = _rp;
                _rp = null;
                rp.processResponse(null);
                int i = 0;
                while (i < evaluators.size()) {
                    evaluators.get(i).sendTransactionResult();
                    i += 1;
                }
View Full Code Here

                System.out.println("unprocessed bytes remaining: " + response);
                Finish.req.send(DB.this, logReader, new RP<Object>() {
                    @Override
                    public void processResponse(Object response) throws Exception {
                        logReader.close();
                        checkpoint(logReader.currentPosition, logReader.timestamp, logFileName, new RP() {
                            @Override
                            public void processResponse(Object response) throws Exception {
                                processLogFile(0L, fi + 1, rp);
                            }
                        });
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor.RP

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.