Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #132

  • Loading branch information...
commit a920a448a5cf2f09e85b779649744870a6e624e8 1 parent 56f60a8
@mdogan mdogan authored
View
41 hazelcast/src/main/java/com/hazelcast/impl/AbstractRecord.java
@@ -56,20 +56,19 @@ public AbstractRecord(CMap cmap, int blockId, Data key, long ttl, long maxIdleMi
}
public void runBackupOps() {
- if (getBackupOps() != null) {
- if (getBackupOps().size() > 0) {
- Iterator<VersionedBackupOp> it = getBackupOps().iterator();
- while (it.hasNext()) {
- VersionedBackupOp bo = it.next();
- if (bo.getVersion() < getVersion() + 1) {
- it.remove();
- } else if (bo.getVersion() == getVersion() + 1) {
- bo.run();
- setVersion(bo.getVersion());
- it.remove();
- } else {
- return;
- }
+ final Set<VersionedBackupOp> backupOps = getBackupOps();
+ if (backupOps != null && !backupOps.isEmpty()) {
+ Iterator<VersionedBackupOp> it = backupOps.iterator();
+ while (it.hasNext()) {
+ VersionedBackupOp bo = it.next();
+ if (bo.getVersion() < getVersion() + 1) {
+ it.remove();
+ } else if (bo.getVersion() == getVersion() + 1) {
+ bo.run();
+ setVersion(bo.getVersion());
+ it.remove();
+ } else {
+ return;
}
}
}
@@ -147,7 +146,7 @@ public void addScheduledAction(ScheduledAction scheduledAction) {
public boolean isRemovable() {
return !isActive() && valueCount() <= 0 && getLockCount() <= 0 && !hasListener()
- && (getScheduledActionCount() == 0) && getBackupOpCount() == 0;
+ && (getScheduledActionCount() == 0) && getBackupOpCount() == 0;
}
public boolean isEvictable() {
@@ -159,14 +158,16 @@ public boolean hasListener() {
}
public void addListener(Address address, boolean returnValue) {
- if (getListeners() == null)
+ if (getListeners() == null) {
setMapListeners(new ConcurrentHashMap<Address, Boolean>(1));
+ }
getListeners().put(address, returnValue);
}
public void removeListener(Address address) {
- if (getListeners() == null)
+ if (getListeners() == null) {
return;
+ }
getListeners().remove(address);
}
@@ -266,7 +267,7 @@ public boolean equals(Object o) {
public String toString() {
return "Record key=" + getKeyData() + ", active=" + isActive()
- + ", version=" + getVersion() + ", removable=" + isRemovable();
+ + ", version=" + getVersion() + ", removable=" + isRemovable();
}
public long getVersion() {
@@ -377,7 +378,8 @@ public void setRemoveTime(long removeTime) {
}
public boolean hasScheduledAction() {
- return optionalInfo != null && optionalInfo.lsScheduledActions != null && optionalInfo.lsScheduledActions.size() > 0;
+ return optionalInfo != null && optionalInfo.lsScheduledActions != null &&
+ optionalInfo.lsScheduledActions.size() > 0;
}
public List<ScheduledAction> getScheduledActions() {
@@ -451,6 +453,7 @@ public boolean isLoadable() {
}
class OptionalInfo {
+
volatile Collection<ValueHolder> lsMultiValues = null; // multimap values
Long[] indexes; // indexes of the current value;
byte[] indexTypes; // index types of the current value;
View
35 hazelcast/src/main/java/com/hazelcast/impl/CMap.java
@@ -534,7 +534,7 @@ public boolean backup(Request req) {
*/
private boolean backupOneValue(Request req) {
Record record = getRecord(req);
- if (record != null && record.isActive() && req.version < record.getVersion()) {
+ if (record != null /* && record.isActive() */ && req.version < record.getVersion()) {
return false;
}
doBackup(req);
@@ -592,33 +592,38 @@ public void doBackup(final Request req) {
ttlPerRecord = true;
}
} else if (req.operation == CONCURRENT_MAP_BACKUP_REMOVE) {
- Record record = getRecord(req);
- if (record != null) {
- if (record.isActive()) {
- markAsEvicted(record);
- }
+// Record record = getRecord(req);
+// if (record != null) {
+// if (record.isActive()) {
+// markAsEvicted(record);
+// }
+// }
+ Record record = toRecord(req);
+ if (record.isActive()) {
+ markAsEvicted(record);
}
+ record.setVersion(req.version);
} else if (req.operation == CONCURRENT_MAP_BACKUP_LOCK) {
if (req.lockCount == 0) {
//UNLOCK operation
- Record rec = getRecord(req);
- if (rec != null) {
- rec.setLock(null);
- if (rec.valueCount() == 0) {
- markAsEvicted(rec);
+ Record record = getRecord(req);
+ if (record != null) {
+ record.setLock(null);
+ if (record.valueCount() == 0) {
+ markAsEvicted(record);
}
}
} else {
// LOCK operation
- Record rec = toRecord(req);
- if (rec.getVersion() == 0) {
- rec.setVersion(req.version);
+ Record record = toRecord(req);
+ if (record.getVersion() == 0) {
+ record.setVersion(req.version);
}
}
} else if (req.operation == CONCURRENT_MAP_BACKUP_ADD) {
add(req, true);
} else if (req.operation == CONCURRENT_MAP_BACKUP_REMOVE_MULTI) {
- final Record record = getRecord(req);
+ Record record = getRecord(req);
if (record != null) {
if (req.value == null || record.valueCount() == 0) {
markAsEvicted(record);
Please sign in to comment.
Something went wrong with that request. Please try again.