Package com.hazelcast.concurrent.lock

Examples of com.hazelcast.concurrent.lock.LockStoreImpl


        this.conditionId = conditionId;
    }

    @Override
    public void beforeRun() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        firstRun = lockStore.startAwaiting(key, conditionId, getCallerUuid(), threadId);
    }
View Full Code Here


        firstRun = lockStore.startAwaiting(key, conditionId, getCallerUuid(), threadId);
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        if (!lockStore.lock(key, getCallerUuid(), threadId)) {
            throw new IllegalMonitorStateException(
                    "Current thread is not owner of the lock! -> " + lockStore.getOwnerInfo(key));
        }

        if (expired) {
            response = false;
        } else {
            lockStore.removeSignalKey(getWaitKey());
            lockStore.removeAwait(key, conditionId, getCallerUuid(), threadId);
            response = true;
        }
    }
View Full Code Here

        return new ConditionKey(namespace.getObjectName(), key, conditionId);
    }

    @Override
    public boolean shouldWait() {
        LockStoreImpl lockStore = getLockStore();
        boolean canAcquireLock = lockStore.canAcquireLock(key, getCallerUuid(), threadId);

        ConditionKey signalKey = lockStore.getSignalKey(key);
        if (signalKey != null && conditionId.equals(signalKey.getConditionId()) && canAcquireLock) {
            return false;
        }

        boolean shouldWait = firstRun || !canAcquireLock;
View Full Code Here

    }

    @Override
    public void onWaitExpire() {
        expired = true;
        LockStoreImpl lockStore = getLockStore();
        lockStore.removeSignalKey(getWaitKey());
        lockStore.removeAwait(key, conditionId, getCallerUuid(), threadId);

        boolean locked = lockStore.lock(key, getCallerUuid(), threadId);
        if (locked) {
            ResponseHandler responseHandler = getResponseHandler();
            // expired & acquired lock, send FALSE
            responseHandler.sendResponse(false);
        } else {
            // expired but could not acquire lock, no response atm
            lockStore.registerExpiredAwaitOp(this);
        }
    }
View Full Code Here

        this.conditionId = conditionId;
    }

    @Override
    public void beforeRun() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        boolean isLockOwner = lockStore.isLockedBy(key, getCallerUuid(), threadId);
        ensureOwner(lockStore, isLockOwner);
    }
View Full Code Here

        }
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        lockStore.addAwait(key, conditionId, getCallerUuid(), threadId);
        lockStore.unlock(key, getCallerUuid(), threadId);
    }
View Full Code Here

        this.originalCallerUuid = originalCallerUuid;
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        if (force) {
            response = lockStore.forceUnlock(key);
        } else {
            response = lockStore.unlock(key, originalCallerUuid, threadId);
        }
        lockStore.pollExpiredAwaitOp(key);
    }
View Full Code Here

        super(namespace, key, -1);
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        response = lockStore.getLockCount(key);
    }
View Full Code Here

        this.originalCaller = originalCaller;
    }

    @Override
    public void run() throws Exception {
        LockStoreImpl lockStore = getLockStore();
        lockStore.addAwait(key, conditionId, originalCaller, threadId);
        lockStore.unlock(key, originalCaller, threadId);
        response = true;
    }
View Full Code Here

            return getLockStore().getBackupCount();
        }
    }

    public final int getAsyncBackupCount() {
        LockStoreImpl lockStore = getLockStore();
        if (asyncBackup) {
            return lockStore.getBackupCount() + lockStore.getAsyncBackupCount();
        } else {
            return lockStore.getAsyncBackupCount();
        }
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.concurrent.lock.LockStoreImpl

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.