Package com.persistit.Accumulator

Examples of com.persistit.Accumulator.Delta


            _droppedCount++;
        }
    }

    private Delta freeDelta(final Delta delta) {
        final Delta next = delta.getNext();
        /*
         * If the free Delta list is already full then simply drop this one and
         * let it be garbage collected
         */
        if (_freeDeltaCount < _transactionIndex.getMaxFreeDeltaListSize()) {
View Full Code Here


        }
        return next;
    }

    Delta allocateDelta() {
        final Delta delta = _freeDeltaList;
        if (delta != null) {
            _freeDeltaList = delta.getNext();
            _freeDeltaCount--;
            return delta;
        } else {
            return new Delta();
        }
    }
View Full Code Here

        delta.setNext(_delta);
        _delta = delta;
    }

    Delta takeDelta() {
        final Delta delta = _delta;
        _delta = null;
        return delta;
    }
View Full Code Here

    Delta addDelta(final TransactionStatus status) {
        final int hashIndex = hashIndex(status.getTs());
        final TransactionIndexBucket bucket = _hashTable[hashIndex];
        bucket.lock();
        try {
            final Delta delta = bucket.allocateDelta();
            status.addDelta(delta);
            return delta;
        } finally {
            bucket.unlock();
        }
View Full Code Here

     *            The value to add or combine.
     */
    void addOrCombineDelta(final TransactionStatus status, final Accumulator accumulator, final int step,
            final long value) {
        // Check current deltas, no lock as status is single txn/thread
        Delta delta = status.getDelta();
        while (delta != null) {
            if (delta.canMerge(accumulator, step)) {
                delta.merge(value);
                return;
            }
            delta = delta.getNext();
        }
        // No compatible existing delta, create a new one
        delta = addDelta(status);
        delta.setAccumulator(accumulator);
        delta.setStep(step);
        delta.setValue(value);
    }
View Full Code Here

    Delta addDelta(final TransactionStatus status) {
        final int hashIndex = hashIndex(status.getTs());
        final TransactionIndexBucket bucket = _hashTable[hashIndex];
        bucket.lock();
        try {
            final Delta delta = bucket.allocateDelta();
            status.addDelta(delta);
            return delta;
        } finally {
            bucket.unlock();
        }
View Full Code Here

     * @return Delta that was created or modified.
     */
    Delta addOrCombineDelta(final TransactionStatus status, final Accumulator accumulator, final int step,
            final long value) {
        // Check current deltas, no lock as status is single txn/thread
        Delta delta = status.getDelta();
        while (delta != null) {
            if (delta.canMerge(accumulator, step)) {
                delta.merge(value);
                return null;
            }
            delta = delta.getNext();
        }
        // No compatible existing delta, create a new one
        delta = addDelta(status);
        delta.setAccumulator(accumulator);
        delta.setStep(step);
        delta.setValue(value);
        return delta;
    }
View Full Code Here

            _droppedCount++;
        }
    }

    private Delta freeDelta(final Delta delta) {
        final Delta next = delta.getNext();
        /*
         * If the free Delta list is already full then simply drop this one and
         * let it be garbage collected
         */
        if (_freeDeltaCount < _transactionIndex.getMaxFreeDeltaListSize()) {
View Full Code Here

        }
        return next;
    }

    Delta allocateDelta() {
        final Delta delta = _freeDeltaList;
        if (delta != null) {
            _freeDeltaList = delta.getNext();
            _freeDeltaCount--;
            return delta;
        } else {
            return new Delta();
        }
    }
View Full Code Here

    Delta addDelta(final TransactionStatus status) {
        final int hashIndex = hashIndex(status.getTs());
        final TransactionIndexBucket bucket = _hashTable[hashIndex];
        bucket.lock();
        try {
            final Delta delta = bucket.allocateDelta();
            status.addDelta(delta);
            return delta;
        } finally {
            bucket.unlock();
        }
View Full Code Here

TOP

Related Classes of com.persistit.Accumulator.Delta

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.