Package com.persistit

Examples of com.persistit.Tree$TreeVersion


    }

    @Override
    public Exchange getExchange(final Session session, final TreeLink link) {
        try {
            final Tree tree = populateTreeCache(link);
            if(!tree.isValid()) {
                throw new IllegalArgumentException("Tree is not valid: " + tree);
            }
            final Exchange exchange = getExchange(session, tree);
            exchange.setAppCache(link);
            return exchange;
View Full Code Here


            final String treeName) throws PersistitException {
        Persistit db = getDb();
        final Volume sysVol = db.getSystemVolume();
        for (final Volume volume : db.getVolumes()) {
            if (volume != sysVol) {
                final Tree tree = volume.getTree(treeName, false);
                if (tree != null) {
                    final Exchange exchange = getExchange(session, tree);
                    try {
                        visitor.visit(exchange);
                    } finally {
View Full Code Here

        }
    }

    @Override
    public Tree populateTreeCache(final TreeLink link) throws PersistitException {
        Tree tree = link.getTreeCache();
        if (tree == null || !tree.isValid()) {
            tree = dataVolume.getTree(link.getTreeName(), true);
            link.setTreeCache(tree);
        }
        return tree;
    }
View Full Code Here

    }

    @Override
    public boolean treeExists(String treeName) {
        try {
            final Tree tree = dataVolume.getTree(treeName, false);
            return tree != null;
        } catch (PersistitException e) {
            throw new PersistitAdapterException(e);
        }
    }
View Full Code Here

     * However, Trees aren't normally removed as they are non-transactional in < Persistit 3.3.0.
     */
    @Test
    public void invalidTreeClearsCache() throws Exception {
        final Exchange ex1 = treeService.getExchange(session(), new TestLink("schema", "someTree"));
        final Tree tree = ex1.getTree();
        treeService.releaseExchange(session(), ex1);
        assertFalse(treeService.exchangeQueue(session(), ex1.getTree()).isEmpty());
        final Exchange ex2 = treeService.getExchange(session(), new TestLink("schema", "someTree"));
        final Exchange ex3 = treeService.getExchange(session(), new TestLink("schema", "someTree"));
        treeService.releaseExchange(session(), ex3);
View Full Code Here

        PersistitStorageDescription desc = createDescription("tree");
        List<Exchange> exchanges = new ArrayList<>();
        for(int i = 0; i < (MAX_EXCHANGE_CACHE * 5); ++i) {
            exchanges.add(treeService.getExchange(session(), desc));
        }
        Tree tree = exchanges.get(0).getTree();
        for(Exchange ex : exchanges) {
            treeService.releaseExchange(session(), ex);
        }
        assertEquals("cached exchange count", MAX_EXCHANGE_CACHE, getCachedExchangeCount(tree));
    }
View Full Code Here

        public void setRowDef(RowDef rowDef) {
            if(rowDef == null) {
                rowCount = autoIncrement = null;
            } else {
                checkExpectedRowDefID(expectedID, rowDef);
                Tree tree = getTreeForRowDef(rowDef);
                rowCount = new AccumulatorAdapter(AccumulatorAdapter.AccumInfo.ROW_COUNT, tree);
                autoIncrement = new AccumulatorAdapter(AccumulatorAdapter.AccumInfo.AUTO_INC, tree);
            }
        }
View Full Code Here

TOP

Related Classes of com.persistit.Tree$TreeVersion

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.