Examples of EntryKey


Examples of org.apache.activegroups.command.EntryKey

            boolean newLock = entryMsg.getKey().isLocked();
            Member newOwner = entryMsg.getKey().getOwner();
            long newLockExpiration = newLock ? entryMsg.getKey()
                    .getLockExpiration() : 0l;
            if (isCoordinator() && !entryMsg.isMapUpdate()) {
                EntryKey originalKey = getKey(entryMsg.getKey().getKey());
                if (originalKey != null) {
                    if (originalKey.isLocked()) {
                        if (!originalKey.getOwner().equals(
                                entryMsg.getKey().getOwner())) {
                            Serializable reply = new GroupUpdateException(
                                    "Owned by " + originalKey.getOwner());
                            sendReply(reply, replyTo, correlationId);
                        } else {
                            originalKey.setLocked(newLock);
                            originalKey.setOwner(newOwner);
                            originalKey.setLockExpiration(newLockExpiration);
                            broadcastMapUpdate(entryMsg, correlationId);
                        }
                    } else {
                        originalKey.setLocked(newLock);
                        originalKey.setOwner(newOwner);
                        originalKey.setLockExpiration(newLockExpiration);
                        broadcastMapUpdate(entryMsg, correlationId);
                    }
                }
            } else {
                EntryKey originalKey = getKey(entryMsg.getKey().getKey());
                if (originalKey != null) {
                    originalKey.setLocked(newLock);
                    originalKey.setOwner(newOwner);
                    originalKey.setLockExpiration(newLockExpiration);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.activegroups.command.EntryKey

            boolean containsKey = false;
            synchronized (this.mapMutex) {
                containsKey = this.localMap.containsKey(key.getKey());
            }
            if (containsKey) {
                EntryKey originalKey = getKey(key.getKey());
                if (originalKey.equals(key.getOwner())
                        || !originalKey.isLocked()) {
                    EntryValue<V> old = null;
                    if (insert) {
                        synchronized (this.mapMutex) {
                            old = this.localMap.put(key.getKey(), value);
                        }
                    } else {
                        synchronized (this.mapMutex) {
                            old = this.localMap.remove(key.getKey());
                        }
                    }
                    entryMsg.setOldValue(old.getValue());
                    broadcastMapUpdate(entryMsg, correlationId);
                    fireMapChanged(key.getOwner(), key.getKey(),
                            old.getValue(), value.getValue(), false);
                } else {
                    Serializable reply = new GroupUpdateException(
                            "Owned by " + originalKey.getOwner());
                    sendReply(reply, replyTo, correlationId);
                }
            } else {
                if (insert) {
                    synchronized (this.mapMutex) {
View Full Code Here

Examples of org.apache.activegroups.command.EntryKey

            synchronized (this.mapMutex) {
                Map<K, EntryValue<V>> map = this.localMap;
                if (map != null) {
                    long currentTime = System.currentTimeMillis();
                    for (EntryValue value : map.values()) {
                        EntryKey k = value.getKey();
                        if (k.isExpired(currentTime)) {
                            if (expiredMessages == null) {
                                expiredMessages = new ArrayList<EntryKey>();
                                expiredMessages.add(k);
                            }
                        } else if (k.isLockExpired(currentTime)) {
                            k.setLocked(false);
                            if (expiredLocks == null) {
                                expiredLocks = new ArrayList<EntryKey>();
                                expiredLocks.add(k);
                            }
                            expiredLocks.add(k);
View Full Code Here

Examples of org.apache.activegroups.command.EntryKey

        boolean mapExists = false;
        synchronized (this.mapMutex) {
            mapExists = this.localMap != null;
            if (mapExists) {
                for (EntryValue value : this.localMap.values()) {
                    EntryKey entryKey = value.getKey();
                    if (entryKey.getOwner().equals(member)) {
                        if (entryKey.isRemoveOnExit()) {
                            tmpList.add(entryKey);
                        }
                        if (entryKey.isReleaseLockOnExit()) {
                            entryKey.setLocked(false);
                        }
                    }
                }
            }
        }
        if (mapExists) {
            for (EntryKey<K> entryKey : tmpList) {
                EntryValue<V> value = null;
                synchronized (this.mapMutex) {
                    value = this.localMap.remove(entryKey);
                }
                fireMapChanged(member, entryKey.getKey(), value.getValue(),
                        null, false);
            }
        }
    }
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.