Package org.agilewiki.jid.scalar.vlens.actor

Examples of org.agilewiki.jid.scalar.vlens.actor.RootJid


                path,
                StandardOpenOption.READ,
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, factory);
        Block block = new LTBlock();
        block.setRootJid(rj);
        long timestamp = System.currentTimeMillis();
        block.setTimestamp(timestamp);
        (new ForcedWriteRootJid(block)).send(future, jFile);
        assertEquals(12L, block.getCurrentPosition());

        Block block2 = new LTBlock();
        (new ReadRootJid(block2)).send(future, jFile);
        RootJid rj2 = block2.getRootJid(mailbox, factory);
        assertNotNull(rj2);
        long timestamp2 = block2.getTimestamp();
        assertEquals(timestamp, timestamp2);

        (new ReadRootJid(block2)).send(future, jFile);
View Full Code Here


        initializeDb(logReaderMaxSize);
        Block block0 = newDbBlock();
        block0.setCurrentPosition(0L);
        block0.setFileName(dbPath.toString());
        dbFile.readRootJid(block0, maxSize);
        RootJid rootJid0 = block0.getRootJid(getMailboxFactory().createMailbox(), getParent());
        long timestamp0 = block0.getTimestamp();
        Block block1 = newDbBlock();
        block1.setCurrentPosition(maxSize);
        block1.setFileName(dbPath.toString());
        dbFile.readRootJid(block1, maxSize);
        RootJid rootJid1 = block1.getRootJid(getMailboxFactory().createMailbox(), getParent());
        long timestamp1 = block0.getTimestamp();
        if (rootJid0 == null) {
            rootJid = rootJid1;
            isFirstRootJid = false;
        } else if (rootJid1 == null) {
View Full Code Here

    }

    public StringMapJid makeStringMapJid()
            throws Exception {
        if (stringMapJid == null) {
            RootJid rj = makeRootJid();
            stringMapJid = (StringMapJid) rj.getValue();
            if (stringMapJid == null) {
                rj.setValue(JidFactories.STRING_ACTOR_MAP_JID_TYPE);
                stringMapJid = (StringMapJid) rj.getValue();
            }
        }
        return stringMapJid;
    }
View Full Code Here

            lj.setValue(logPosition);
            pendingWrite = true;
            Block block = newDbBlock();
            rootJid = (RootJid) rootJid.copyJID(getMailboxFactory().createMailbox());
            stringMapJid = null;
            RootJid rj = (RootJid) rootJid.copyJID(getMailboxFactory().createMailbox());
            block.setRootJid(rj);
            block.setTimestamp(timestamp);
            if (isFirstRootJid) {
                isFirstRootJid = false;
                block.setCurrentPosition(maxSize);
View Full Code Here

                path,
                StandardOpenOption.READ,
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, factory);
        Block block = new LBlock();
        block.setRootJid(rj);
        (new ForcedWriteRootJid(block)).send(future, jFile);
        assertEquals(4L, block.getCurrentPosition());

        Block block2 = new LBlock();
        (new ReadRootJid(block2)).send(future, jFile);
        RootJid rj2 = block2.getRootJid(mailbox, factory);
        assertNotNull(rj2);

        (new ReadRootJid(block2)).send(future, jFile);
        rj2 = block2.getRootJid(mailbox, factory);
        assertNull(rj2);
View Full Code Here

                path,
                StandardOpenOption.READ,
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, factory);
        Block block = new LTA32Block();
        block.setRootJid(rj);
        long timestamp = System.currentTimeMillis();
        block.setTimestamp(timestamp);
        (new ForcedWriteRootJid(block)).send(future, jFile);
        assertEquals(20L, block.getCurrentPosition());

        Block block2 = new LTA32Block();
        (new ReadRootJid(block2)).send(future, jFile);
        RootJid rj2 = block2.getRootJid(mailbox, factory);
        assertNotNull(rj2);
        long timestamp2 = block2.getTimestamp();
        assertEquals(timestamp, timestamp2);

        (new ReadRootJid(block2)).send(future, jFile);
View Full Code Here

        Mailbox mailbox = mailboxFactory.createMailbox();
        JAFactory factory = new JAFactory();
        factory.initialize(mailbox);
        (new JidFactories()).initialize(mailbox, factory);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, factory);
        LBlock lb1 = new LBlock();
        lb1.setRootJid(rj);
        byte[] bs = lb1.serialize();

        int hl = lb1.headerLength();
        int rjl = rj.getSerializedLength();
        assertEquals(bs.length, hl + rjl);

        byte[] h = new byte[hl];
        System.arraycopy(bs, 0, h, 0, hl);
        byte[] sd = new byte[rjl];
        System.arraycopy(bs, hl, sd, 0, rjl);

        LBlock lb2 = new LBlock();
        int rjl2 = lb2.setHeaderBytes(h);
        lb2.setRootJidBytes(sd);
        RootJid rj2 = lb2.getRootJid(mailbox, factory);

        mailboxFactory.close();
    }
View Full Code Here

                path,
                StandardOpenOption.READ,
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, factory);
        Block block = new LA32Block();
        block.setRootJid(rj);
        (new ForcedWriteRootJid(block)).send(future, jFile);
        assertEquals(12L, block.getCurrentPosition());

        Block block2 = new LA32Block();
        (new ReadRootJid(block2)).send(future, jFile);
        RootJid rj2 = block2.getRootJid(mailbox, factory);
        assertNotNull(rj2);

        (new ReadRootJid(block2)).send(future, jFile);
        rj2 = block2.getRootJid(mailbox, factory);
        assertNull(rj2);
View Full Code Here

                        exception);
                mailboxFactory.close();
                System.exit(1);
            }
        });
        RootJid rootJid = block.getRootJid();
        GetActor.req.send(this, rootJid, new RP<Actor>() {
            @Override
            public void processResponse(Actor response) throws Exception {
                Evaluator evaluator = (Evaluator) response;
                Eval eval = new Eval(block.getTimestamp());
View Full Code Here

    private void makeRootJid()
            throws Exception {
        if (rootJid != null)
            return;
        rootJid = new RootJid();
        rootJid.initialize(getMailboxFactory().createMailbox(), getParent());
        rootJid.setValue(JFileFactories.EVALUATER_LIST_JID_TYPE);
        transactionListJid = (EvaluatorListJid) rootJid.getValue();
    }
View Full Code Here

TOP

Related Classes of org.agilewiki.jid.scalar.vlens.actor.RootJid

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.