use of org.apache.geode.internal.cache.wan.GatewaySenderEventCallbackArgument in project geode by apache.
the class LocalRegion method basicBridgePutAll.
/**
* Called on a bridge server when it has a received a putAll command from a client.
*
* @param map a map of key->value for the entries we are putting
* @param retryVersions a map of key->version tag. If any of the entries are the result of a
* retried client event, we need to make sure we send the original version tag along with
* the event.
* @param callbackArg callback argument from client
*/
public VersionedObjectList basicBridgePutAll(Map map, Map<Object, VersionTag> retryVersions, ClientProxyMembershipID memberId, EventID eventId, boolean skipCallbacks, Object callbackArg) throws TimeoutException, CacheWriterException {
long startPut = CachePerfStats.getStatTime();
if (isGatewaySenderEnabled()) {
callbackArg = new GatewaySenderEventCallbackArgument(callbackArg);
}
@Released final EntryEventImpl event = EntryEventImpl.create(this, Operation.PUTALL_CREATE, null, null, /* new value */
callbackArg, false, /* origin remote */
memberId.getDistributedMember(), !skipCallbacks, /* generateCallbacks */
eventId);
try {
event.setContext(memberId);
DistributedPutAllOperation putAllOp = new DistributedPutAllOperation(event, map.size(), true);
try {
VersionedObjectList result = basicPutAll(map, putAllOp, retryVersions);
getCachePerfStats().endPutAll(startPut);
return result;
} finally {
putAllOp.freeOffHeapResources();
}
} finally {
event.release();
}
}
use of org.apache.geode.internal.cache.wan.GatewaySenderEventCallbackArgument in project geode by apache.
the class LocalRegion method basicBridgeRemove.
// TODO: fromClient is always true
public void basicBridgeRemove(Object key, Object expectedOldValue, Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent) throws TimeoutException, EntryNotFoundException, CacheWriterException {
if (fromClient) {
// GatewayEventCallbackArgument to store the event id.
if (isGatewaySenderEnabled()) {
callbackArg = new GatewaySenderEventCallbackArgument(callbackArg);
}
}
// Create an event and put the entry
@Released final EntryEventImpl event = EntryEventImpl.create(this, Operation.REMOVE, key, null, callbackArg, false, memberId.getDistributedMember(), true, clientEvent.getEventId());
try {
event.setContext(memberId);
// place. AbstractRegionMap performs the checks and throws the exception
try {
basicDestroy(event, true, expectedOldValue);
} finally {
clientEvent.setVersionTag(event.getVersionTag());
clientEvent.setIsRedestroyedEntry(event.getIsRedestroyedEntry());
}
} finally {
event.release();
}
}
use of org.apache.geode.internal.cache.wan.GatewaySenderEventCallbackArgument in project geode by apache.
the class LocalRegion method basicBridgeInvalidate.
// TODO: fromClient is always true
public void basicBridgeInvalidate(Object key, Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent) throws TimeoutException, EntryNotFoundException, CacheWriterException {
Object theCallbackArg = callbackArg;
if (fromClient) {
// GatewayEventCallbackArgument to store the event id.
if (isGatewaySenderEnabled()) {
theCallbackArg = new GatewaySenderEventCallbackArgument(theCallbackArg);
}
}
// Create an event and put the entry
@Released final EntryEventImpl event = EntryEventImpl.create(this, Operation.INVALIDATE, key, null, theCallbackArg, false, memberId.getDistributedMember(), true, clientEvent.getEventId());
try {
event.setContext(memberId);
// if this is a replayed operation we may already have a version tag
event.setVersionTag(clientEvent.getVersionTag());
try {
basicInvalidate(event);
} finally {
clientEvent.setVersionTag(event.getVersionTag());
clientEvent.isConcurrencyConflict(event.isConcurrencyConflict());
}
} finally {
event.release();
}
}
Aggregations