Package net.sf.ehcache.transaction

Examples of net.sf.ehcache.transaction.SoftLock.lock()


                           ElementValueComparator comparator) {
        Object objectKey = getObjectKey();

        SoftLock softLock = softLockFactory.createSoftLock(transactionId, objectKey, newElement, oldElement);
        softLockedElement = createElement(objectKey, softLock);
        softLock.lock();
        softLock.freeze();

        if (oldElement == null) {
            Element previousElement = store.putIfAbsent(softLockedElement);
            if (previousElement != null) {
View Full Code Here


            Element oldElement = underlyingStore.getQuiet(key);
            if (oldElement == null) {
                SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                        element, oldElement);
                softLock.lock();
                Element newElement = createElement(key, softLock);
                oldElement = underlyingStore.putIfAbsent(newElement);
                if (oldElement == null) {
                    // CAS succeeded, soft lock is in store, job done.
                    getCurrentTransactionContext().registerSoftLock(cacheName, this, softLock);
View Full Code Here

                        continue;
                    }
                } else {
                    SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                            element, oldElement);
                    softLock.lock();
                    Element newElement = createElement(key, softLock);
                    boolean replaced = underlyingStore.replace(oldElement, newElement, comparator);
                    if (replaced) {
                        // CAS succeeded, value replaced with soft lock, job done.
                        getCurrentTransactionContext().registerSoftLock(cacheName, this, softLock);
View Full Code Here

            Element oldElement = underlyingStore.getQuiet(key);
            if (oldElement == null) {
                SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                        null, oldElement);
                softLock.lock();
                Element newElement = createElement(key, softLock);
                oldElement = underlyingStore.putIfAbsent(newElement);
                if (oldElement == null) {
                    // CAS succeeded, value is in store, job done.
                    getCurrentTransactionContext().registerSoftLock(cacheName, this, softLock);
View Full Code Here

                        continue;
                    }
                } else {
                    SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                            null, oldElement);
                    softLock.lock();
                    Element newElement = createElement(key, softLock);
                    boolean replaced = underlyingStore.replace(oldElement, newElement, comparator);
                    if (replaced) {
                        // CAS succeeded, value replaced with soft lock, job done.
                        getCurrentTransactionContext().registerSoftLock(cacheName, this, softLock);
View Full Code Here

            Element oldElement = underlyingStore.getQuiet(key);
            if (oldElement == null || !(oldElement.getObjectValue() instanceof SoftLock)) {
                SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                        element, oldElement);
                softLock.lock();
                Element newElement = createElement(key, softLock);
                oldElement = underlyingStore.putIfAbsent(newElement);
                if (oldElement == null) {
                    // CAS succeeded, soft lock is in store, job done.
                    getCurrentTransactionContext().registerSoftLock(cacheName, this, softLock);
View Full Code Here

                        continue;
                    }
                } else {
                    SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                            null, oldElement);
                    softLock.lock();
                    Element newElement = createElement(key, softLock);

                    boolean replaced = underlyingStore.replace(oldElement, newElement, comparator);
                    if (replaced) {
                        // CAS succeeded, value replaced with soft lock, job done.
View Full Code Here

                        continue;
                    }
                } else {
                    SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                            element, oldElement);
                    softLock.lock();
                    Element newElement = createElement(key, softLock);

                    boolean replaced = underlyingStore.replace(oldElement, newElement, comparator);
                    if (replaced) {
                        // CAS succeeded, value replaced with soft lock, job done.
View Full Code Here

                        continue;
                    }
                } else {
                    SoftLock softLock = softLockFactory.createSoftLock(getCurrentTransactionContext().getTransactionId(), key,
                            element, oldElement);
                    softLock.lock();
                    Element newElement = createElement(key, softLock);

                    Element replaced = underlyingStore.replace(newElement);
                    if (replaced != null) {
                        // CAS succeeded, value replaced with soft lock, job done.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.