use of org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData in project geode by apache.
the class DistTxEntryEvent method removeAllFromData.
/**
* @param in
* @throws IOException
* @throws ClassNotFoundException
*/
private void removeAllFromData(DataInput in) throws IOException, ClassNotFoundException {
int removeAllSize = DataSerializer.readInteger(in);
final RemoveAllEntryData[] removeAllData = new RemoveAllEntryData[removeAllSize];
final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
for (int i = 0; i < removeAllSize; i++) {
removeAllData[i] = new RemoveAllEntryData(in, this.eventID, i, version, bytesIn);
}
boolean hasTags = in.readBoolean();
if (hasTags) {
EntryVersionsList versionTags = EntryVersionsList.create(in);
for (int i = 0; i < removeAllSize; i++) {
removeAllData[i].versionTag = versionTags.get(i);
}
}
// TODO DISTTX: release this event
EntryEventImpl e = EntryEventImpl.create(this.region, Operation.REMOVEALL_DESTROY, null, null, null, true, this.getDistributedMember(), true, true);
this.removeAllOp = new DistributedRemoveAllOperation(e, removeAllSize, false);
this.removeAllOp.setRemoveAllEntryData(removeAllData);
}
use of org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData in project geode by apache.
the class DistTxEntryEvent method removeAllToData.
/**
* @param out
* @throws IOException
*/
private void removeAllToData(DataOutput out) throws IOException {
DataSerializer.writeInteger(this.removeAllOp.removeAllDataSize, out);
EntryVersionsList versionTags = new EntryVersionsList(this.removeAllOp.removeAllDataSize);
boolean hasTags = false;
final RemoveAllEntryData[] removeAllData = this.removeAllOp.getRemoveAllEntryData();
for (int i = 0; i < this.removeAllOp.removeAllDataSize; i++) {
if (!hasTags && removeAllData[i].versionTag != null) {
hasTags = true;
}
VersionTag<?> tag = removeAllData[i].versionTag;
versionTags.add(tag);
removeAllData[i].versionTag = null;
removeAllData[i].toData(out);
removeAllData[i].versionTag = tag;
}
out.writeBoolean(hasTags);
if (hasTags) {
InternalDataSerializer.invokeToData(versionTags, out);
}
}
use of org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData in project geode by apache.
the class FilterProfile method getLocalFilterRoutingForRemoveAllOp.
/**
* computes FilterRoutingInfo objects for each of the given events
*/
public void getLocalFilterRoutingForRemoveAllOp(DistributedRemoveAllOperation op, RemoveAllEntryData[] removeAllData) {
if (this.region != null && this.localProfile.hasCacheServer) {
Set clientsInv = null;
Set clients = null;
int size = removeAllData.length;
CqService cqService = getCqService(op.getRegion());
boolean doCQs = cqService.isRunning() && this.region != null;
for (int idx = 0; idx < size; idx++) {
RemoveAllEntryData pEntry = removeAllData[idx];
if (pEntry != null) {
@Unretained final EntryEventImpl ev = op.getEventForPosition(idx);
FilterRoutingInfo fri = pEntry.filterRouting;
FilterInfo fi = null;
if (fri != null) {
fi = fri.getLocalFilterInfo();
}
if (logger.isDebugEnabled()) {
logger.debug("Finding locally interested clients for {}", ev);
}
if (doCQs) {
if (fri == null) {
fri = new FilterRoutingInfo();
}
fillInCQRoutingInfo(ev, true, NO_PROFILES, fri);
fi = fri.getLocalFilterInfo();
}
if (this.allKeyClientsInv != null || this.keysOfInterestInv != null || this.patternsOfInterestInv != null || this.filtersOfInterestInv != null) {
clientsInv = this.getInterestedClients(ev, this.allKeyClientsInv, this.keysOfInterestInv, this.patternsOfInterestInv, this.filtersOfInterestInv);
}
if (this.allKeyClients != null || this.keysOfInterest != null || this.patternsOfInterest != null || this.filtersOfInterest != null) {
clients = this.getInterestedClients(ev, this.allKeyClients, this.keysOfInterest, this.patternsOfInterest, this.filtersOfInterest);
}
if (clients != null || clientsInv != null) {
if (fi == null) {
fi = new FilterInfo();
// no need to create or update a FilterRoutingInfo at this time
}
fi.setInterestedClients(clients);
fi.setInterestedClientsInv(clientsInv);
}
// if (this.logger.fineEnabled()) {
// this.region.getLogWriterI18n().fine("setting event routing to " + fi);
// }
ev.setLocalFilterInfo(fi);
}
}
}
}
use of org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData in project geode by apache.
the class RemoveAllPRMessage method fromData.
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.bucketId = Integer.valueOf((int) InternalDataSerializer.readSignedVL(in));
if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
this.bridgeContext = DataSerializer.readObject(in);
}
Version sourceVersion = InternalDataSerializer.getVersionForDataStream(in);
this.callbackArg = DataSerializer.readObject(in);
this.removeAllPRDataSize = (int) InternalDataSerializer.readUnsignedVL(in);
this.removeAllPRData = new RemoveAllEntryData[removeAllPRDataSize];
if (this.removeAllPRDataSize > 0) {
final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
for (int i = 0; i < this.removeAllPRDataSize; i++) {
this.removeAllPRData[i] = new RemoveAllEntryData(in, null, i, version, bytesIn);
}
boolean hasTags = in.readBoolean();
if (hasTags) {
EntryVersionsList versionTags = EntryVersionsList.create(in);
for (int i = 0; i < this.removeAllPRDataSize; i++) {
this.removeAllPRData[i].versionTag = versionTags.get(i);
}
}
}
}
use of org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData in project geode by apache.
the class RemoveAllPRMessage method getEventFromEntry.
@Retained
public static EntryEventImpl getEventFromEntry(LocalRegion r, InternalDistributedMember myId, InternalDistributedMember eventSender, int idx, DistributedRemoveAllOperation.RemoveAllEntryData[] data, boolean notificationOnly, ClientProxyMembershipID bridgeContext, boolean posDup, boolean skipCallbacks) {
RemoveAllEntryData dataItem = data[idx];
@Retained EntryEventImpl ev = EntryEventImpl.create(r, dataItem.getOp(), dataItem.getKey(), null, null, false, eventSender, !skipCallbacks, dataItem.getEventID());
boolean evReturned = false;
try {
ev.setOldValue(dataItem.getOldValue());
if (bridgeContext != null) {
ev.setContext(bridgeContext);
}
ev.setInvokePRCallbacks(!notificationOnly);
ev.setPossibleDuplicate(posDup);
if (dataItem.filterRouting != null) {
ev.setLocalFilterInfo(dataItem.filterRouting.getFilterInfo(myId));
}
if (dataItem.versionTag != null) {
dataItem.versionTag.replaceNullIDs(eventSender);
ev.setVersionTag(dataItem.versionTag);
}
if (notificationOnly) {
ev.setTailKey(-1L);
} else {
ev.setTailKey(dataItem.getTailKey());
}
evReturned = true;
return ev;
} finally {
if (!evReturned) {
ev.release();
}
}
}
Aggregations