Package com.persistit

Examples of com.persistit.Exchange


        }

        for (String treeName : treeNames) {
            try {
                Exchange ex = new Exchange(db, volume, treeName, false);
                ex.removeTree();
            } catch (PersistitException ex) {
                throw new PermanentStorageException(ex);
            }

        }
View Full Code Here


        return getExchange(treeName, true);
    }

    public Exchange getExchange(String treeName, Boolean create) throws StorageException {
        synchronized (this) {
            Exchange exchange;
            try {
                assign();
                exchange = db.getExchange(VOLUME_NAME, treeName, create);
                return exchange;
            } catch (PersistitException ex) {
View Full Code Here

        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;
        } catch (PersistitException e) {
            throw PersistitAdapter.wrapPersistitException(session, e);
        }
    }
View Full Code Here

    }

    @Override
    public Exchange getExchange(final Session session, final Tree tree) {
        Queue<Exchange> queue = exchangeQueue(session, tree);
        Exchange ex = queue.poll();
        if(ex == null) {
            ex = new Exchange(tree);
        }
        return ex;
    }
View Full Code Here

        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 {
                        releaseExchange(session, exchange);
                    }
View Full Code Here

    @Override
    public void removeStatistics(Session session, Index index) {
        try {
            RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
            Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
            removeStatisticsInternal(session, index, exchange);
        } catch(PersistitException | RollbackException e) {
            throw PersistitAdapter.wrapPersistitException(session, e);
        }
    }
View Full Code Here

    private IndexStatistics loadIndexStatisticsInternal(Session session, Index index) throws PersistitException {
        RowDef indexRowDef = index.leafMostTable().rowDef();
        RowDef indexStatisticsRowDef = getIndexStatsRowDef(session);
        RowDef indexStatisticsEntryRowDef = getIndexStatsEntryRowDef(session);

        Exchange exchange = getStore().getExchange(session, indexStatisticsRowDef);
        exchange.clear()
            .append(indexStatisticsRowDef.table().getOrdinal())
            .append((long)indexRowDef.getRowDefId())
            .append((long)index.getIndexId());
        if (!exchange.fetch().getValue().isDefined()) {
            return null;
        }
        IndexStatistics result = decodeHeader(session, exchange, indexStatisticsRowDef, index);
        while (exchange.traverse(Key.GT, true)) {
            if (exchange.getKey().getDepth() <= indexStatisticsRowDef.getHKeyDepth()) {
                break;          // End of children.
            }
            decodeEntry(session, exchange, indexStatisticsEntryRowDef, result);
        }
        if (logger.isDebugEnabled()) {
View Full Code Here

            }
            tempVolumeState.acquire();
            if(injectIOException) {
                throw new PersistitIOException(new IOException());
            }
            Exchange ex = new Exchange(persistit, tempVolumeState.volume(), treeName, true);
            success = true;
            return ex;
        } catch (PersistitException | RollbackException e) {
            if (!PersistitAdapter.isFromInterruption(e))
                LOG.debug("Caught exception while getting exchange for sort", e);
View Full Code Here

            this.operation = operation;
        }

        @Override
        public void run(Session session) {
            Exchange exchange = store.createStoreData(session, index);
            key.copyTo(exchange.getKey());
            try {
                checkReferencing(session, index, exchange, row, foreignKey, operation, true);
            }
            finally {
                store.releaseStoreData(session, exchange);
View Full Code Here

            this.operation = operation;
        }

        @Override
        public void run(Session session) {
            Exchange exchange = store.createStoreData(session, index);
            key.copyTo(exchange.getKey());
            try {
                // selfReference = false on recheck; we deleted one row.
                checkNotReferenced(session, index, exchange, row, foreignKey, false, action, operation, true);
            }
            finally {
View Full Code Here

TOP

Related Classes of com.persistit.Exchange

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.