Package org.agilewiki.jfile.block

Examples of org.agilewiki.jfile.block.Block


        (new SetActor("helloWorldTransaction")).send(future, transactionActorJid);
        (new IAdd(-1)).send(future, transactionListJid);
        transactionActorJid = (EvaluatorActorJid) (new IGet(-1)).send(future, transactionListJid);
        (new SetActor("helloWorldTransaction")).send(future, transactionActorJid);

        Block block = new LTBlock();
        block.setRootJid(rj);
        long timestamp = System.currentTimeMillis();
        block.setTimestamp(timestamp);
        (new ForcedWriteRootJid(block)).send(future, jFile);

        (new ProcessBlock(block)).send(future, transactionProcessor);

        jFile.close();
View Full Code Here


                StandardOpenOption.CREATE);

        RootJid rj = new RootJid();
        rj.initialize(mailbox, db);
        (new SetActor("helloWorldTransaction")).send(future, rj);
        Block block = new LTBlock();
        block.setRootJid(rj);
        long timestamp = System.currentTimeMillis();
        block.setTimestamp(timestamp);
        (new ForcedWriteRootJid(block)).send(future, jFile);

        (new ProcessBlock(block)).send(future, transactionProcessor);

        jFile.close();
View Full Code Here

                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);
        rj2 = block2.getRootJid(mailbox, factory);
        assertNull(rj2);

        jFile.fileChannel.close();
        mailboxFactory.close();
    }
View Full Code Here

                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);

        jFile.fileChannel.close();
        mailboxFactory.close();
    }
View Full Code Here

                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);
        rj2 = block2.getRootJid(mailbox, factory);
        assertNull(rj2);

        jFile.fileChannel.close();
        mailboxFactory.close();
    }
View Full Code Here

                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);

        jFile.fileChannel.close();
        mailboxFactory.close();
    }
View Full Code Here

            throws Exception {
        Finish.req.send(this, blockFlowBuffer, rp);
    }

    public void processBlock(ProcessBlock req, RP rp) throws Exception {
        Block block = req.block;
        block.setFileName(getFileName());
        block.setCurrentPosition(currentPosition);
        forcedWriteRootJid(block, -1);
        currentPosition = block.getCurrentPosition();
        req.send(DurableTransactionLogger.this, blockFlowBuffer, rp);
    }
View Full Code Here

    private void writeBlock()
            throws Exception {
        if (rootJid == null)
            return;
        final Block block = newBlock();
        block.setRootJid(rootJid);
        rootJid = null;
        writePending = true;
        UniqueClock uc = UniqueClock.uc(getMailboxFactory());
        UniqueTimestamp.req.send(this, uc, new RP<Long>() {
            public void processResponse(Long response)
                    throws Exception {
                block.setTimestamp(response);
                (new ProcessBlock(block)).send(TransactionAggregator.this, blockFlowBuffer, new RP<Object>() {
                    @Override
                    public void processResponse(Object response)
                            throws Exception {
                        writePending = false;
View Full Code Here

    private boolean async;

    private void reader()
            throws Exception {
        while (true) {
            Block block = newBlock();
            block.setFileName(getFileName());
            block.setCurrentPosition(currentPosition);
            readRootJid(block, maxSize);
            currentPosition = block.getCurrentPosition();
            if (block.isEmpty()) {
                long position = block.getCurrentPosition();
                long size = fileChannel.size();
                long rem = size - position;
                RP<Long> rp = _rp;
                _rp = null;
                rp.processResponse(rem);
                return;
            }
            timestamp = block.getTimestamp();
            ProcessBlock req = new ProcessBlock(block);
            sync = false;
            async = false;
            req.send(this, blockFlowBuffer, new RP<Object>() {
                @Override
View Full Code Here

                dbPath,
                StandardOpenOption.READ,
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE);
        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

TOP

Related Classes of org.agilewiki.jfile.block.Block

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.