public static EntryOperator operator(MapOperation mapOperation, Object processor) { return new EntryOperator(mapOperation, processor, null, false); }
public EntryOperator operateOnKey(Data dataKey) { init(dataKey, null, null, null, null); if (belongsAnotherPartition(dataKey)) { return this; } oldValue = recordStore.get(dataKey, backup, callerAddress); // predicated entry processors can only be applied to existing entries // so if we have a predicate and somehow(due to expiration or split-brain healing) // we found value null, we should skip that entry. if (predicate != null && oldValue == null) { return this; } Boolean locked = recordStore.isLocked(dataKey); return operateOnKeyValueInternal(dataKey, clonedOrRawOldValue(), locked); }
private EntryOperator operateOnKeyValueInternal(Data dataKey, Object oldValue, Boolean locked) { init(dataKey, oldValue, null, null, null); Map.Entry entry = createMapEntry(dataKey, oldValue, locked); if (outOfPredicateScope(entry)) { return this; } process(entry); findModificationType(entry); newValue = entry.getValue(); if (readOnly && entryWasModified()) { throwModificationInReadOnlyException(); } return this; }
@Override public void run() { operator(this, entryProcessor) .operateOnKey(dataKey).doPostOperateOps(); }
@Override public CallStatus call() { if (shouldWait()) { return WAIT; } if (offload) { return new EntryOperationOffload(getCallerAddress()); } else { response = operator(this, entryProcessor) .operateOnKey(dataKey) .doPostOperateOps() .getResult(); return DONE_RESPONSE; } }
@Override public void run() { try { EntryOperator entryOperator = operator(EntryOperation.this, entryProcessor) .operateOnKeyValue(dataKey, oldValue); Data result = entryOperator.getResult(); EntryEventType modificationType = entryOperator.getEventType(); if (modificationType != null) { Data newValue = serializationService.toData(entryOperator.getNewValue()); updateAndUnlock(serializationService.toData(oldValue), newValue, modificationType, finalCaller, finalThreadId, result, finalBegin); } else { unlockOnly(result, finalCaller, finalThreadId, finalBegin); } } catch (Throwable t) { getLogger().severe("Unexpected error on Offloadable execution", t); unlockOnly(t, finalCaller, finalThreadId, finalBegin); } } });
@Override public void run() throws Exception { verifyLock(); try { operator(this).init(dataKey, oldValue, newValue, null, modificationType) .doPostOperateOps(); } finally { unlockKey(); } }
private void onRemove() { if (backup) { recordStore.removeBackup(dataKey, NOT_WAN); } else { recordStore.delete(dataKey, NOT_WAN); mapServiceContext.interceptAfterRemove(mapName, oldValue); stats.incrementRemoveLatencyNanos(getLatencyNanos(startTimeNanos)); } }
private void publishWanReplicationEvent() { assert entryWasModified(); if (eventType == REMOVED) { mapOperation.publishWanRemove(dataKey); } else { mapOperation.publishWanUpdate(dataKey, newValue); } }
@Override public CallStatus call() { if (shouldWait()) { return WAIT; } if (offload) { return new EntryOperationOffload(getCallerAddress()); } else { response = operator(this, entryProcessor) .operateOnKey(dataKey) .doPostOperateOps() .getResult(); return DONE_RESPONSE; } }
@Override public void run() { operator(this, entryProcessor) .operateOnKey(dataKey).doPostOperateOps(); }
@Override public void run() { try { EntryOperator entryOperator = operator(EntryOperation.this, entryProcessor) .operateOnKeyValue(dataKey, oldValue); Data result = entryOperator.getResult(); EntryEventType modificationType = entryOperator.getEventType(); if (modificationType != null) { Data newValue = serializationService.toData(entryOperator.getNewValue()); updateAndUnlock(serializationService.toData(oldValue), newValue, modificationType, finalCaller, finalThreadId, result, finalBegin); } else { unlockOnly(result, finalCaller, finalThreadId, finalBegin); } } catch (Throwable t) { getLogger().severe("Unexpected error on Offloadable execution", t); unlockOnly(t, finalCaller, finalThreadId, finalBegin); } } });
@Override public void run() throws Exception { verifyLock(); try { operator(this).init(dataKey, oldValue, newValue, null, modificationType) .doPostOperateOps(); } finally { unlockKey(); } }
private void onRemove() { if (backup) { recordStore.removeBackup(dataKey, NOT_WAN); } else { recordStore.delete(dataKey, NOT_WAN); mapServiceContext.interceptAfterRemove(mapName, oldValue); stats.incrementRemoveLatencyNanos(getLatencyNanos(startTimeNanos)); } }
private void publishWanReplicationEvent() { assert entryWasModified(); if (eventType == REMOVED) { mapOperation.publishWanRemove(dataKey); } else { mapOperation.publishWanUpdate(dataKey, newValue); } }
private EntryOperator operateOnKeyValueInternal(Data dataKey, Object oldValue, Boolean locked) { init(dataKey, oldValue, null, null, null); Map.Entry entry = createMapEntry(dataKey, oldValue, locked); if (outOfPredicateScope(entry)) { return this; } process(entry); findModificationType(entry); newValue = entry.getValue(); if (readOnly && entryWasModified()) { throwModificationInReadOnlyException(); } return this; }
@Override @SuppressWarnings("checkstyle:npathcomplexity") public void run() throws Exception { responses = new MapEntries(keys.size()); if (keys.isEmpty()) { return; } EntryOperator operator = operator(this, entryProcessor, getPredicate()); for (Data key : keys) { Data response = operator.operateOnKey(key).doPostOperateOps().getResult(); if (response != null) { responses.add(key, response); } } }
@Override public void run() throws Exception { EntryOperator operator = operator(this, backupProcessor, getPredicate()); for (Data key : keys) { operator.operateOnKey(key).doPostOperateOps(); } }
public EntryOperator operateOnKey(Data dataKey) { init(dataKey, null, null, null, null); if (belongsAnotherPartition(dataKey)) { return this; } oldValue = recordStore.get(dataKey, backup, callerAddress); // predicated entry processors can only be applied to existing entries // so if we have a predicate and somehow(due to expiration or split-brain healing) // we found value null, we should skip that entry. if (predicate != null && oldValue == null) { return this; } Boolean locked = recordStore.isLocked(dataKey); return operateOnKeyValueInternal(dataKey, clonedOrRawOldValue(), locked); }
public static EntryOperator operator(MapOperation mapOperation, Object processor, Predicate predicate) { return new EntryOperator(mapOperation, processor, predicate, false); }