Search in sources :

Example 6 with PutAllEntryData

use of org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData in project geode by apache.

the class DistTxEntryEvent method putAllFromData.

/**
   * @param in
   * @throws IOException
   * @throws ClassNotFoundException
   */
private void putAllFromData(DataInput in) throws IOException, ClassNotFoundException {
    int putAllSize = DataSerializer.readInteger(in);
    PutAllEntryData[] putAllEntries = new PutAllEntryData[putAllSize];
    if (putAllSize > 0) {
        final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
        final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
        for (int i = 0; i < putAllSize; i++) {
            putAllEntries[i] = new PutAllEntryData(in, this.eventID, i, version, bytesIn);
        }
        boolean hasTags = in.readBoolean();
        if (hasTags) {
            EntryVersionsList versionTags = EntryVersionsList.create(in);
            for (int i = 0; i < putAllSize; i++) {
                putAllEntries[i].versionTag = versionTags.get(i);
            }
        }
    }
    // TODO DISTTX: release this event?
    EntryEventImpl e = EntryEventImpl.create(this.region, Operation.PUTALL_CREATE, null, null, null, true, this.getDistributedMember(), true, true);
    this.putAllOp = new DistributedPutAllOperation(e, putAllSize, false);
    this.putAllOp.setPutAllEntryData(putAllEntries);
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) Version(org.apache.geode.internal.Version) EntryEventImpl(org.apache.geode.internal.cache.EntryEventImpl) DistributedPutAllOperation(org.apache.geode.internal.cache.DistributedPutAllOperation) ByteArrayDataInput(org.apache.geode.internal.ByteArrayDataInput) PutAllEntryData(org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData)

Example 7 with PutAllEntryData

use of org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData in project geode by apache.

the class PutAllPRMessage method getEventFromEntry.

@Retained
public static EntryEventImpl getEventFromEntry(LocalRegion r, InternalDistributedMember myId, InternalDistributedMember eventSender, int idx, DistributedPutAllOperation.PutAllEntryData[] data, boolean notificationOnly, ClientProxyMembershipID bridgeContext, boolean posDup, boolean skipCallbacks) {
    PutAllEntryData prd = data[idx];
    // EntryEventImpl ev = EntryEventImpl.create(r,
    // prd.getOp(),
    // prd.getKey(), null/* value */, null /* callbackArg */,
    // false /* originRemote */,
    // eventSender,
    // true/* generate Callbacks */,
    // prd.getEventID());
    @Retained EntryEventImpl ev = EntryEventImpl.create(r, prd.getOp(), prd.getKey(), prd.getValue(), null, false, eventSender, !skipCallbacks, prd.getEventID());
    boolean evReturned = false;
    try {
        if (prd.getValue() == null && ev.getRegion().getAttributes().getDataPolicy() == DataPolicy.NORMAL) {
            ev.setLocalInvalid(true);
        }
        ev.setNewValue(prd.getValue());
        ev.setOldValue(prd.getOldValue());
        if (bridgeContext != null) {
            ev.setContext(bridgeContext);
        }
        ev.setInvokePRCallbacks(!notificationOnly);
        ev.setPossibleDuplicate(posDup);
        if (prd.filterRouting != null) {
            ev.setLocalFilterInfo(prd.filterRouting.getFilterInfo(myId));
        }
        if (prd.versionTag != null) {
            prd.versionTag.replaceNullIDs(eventSender);
            ev.setVersionTag(prd.versionTag);
        }
        // ev.setLocalFilterInfo(r.getFilterProfile().getLocalFilterRouting(ev));
        if (notificationOnly) {
            ev.setTailKey(-1L);
        } else {
            ev.setTailKey(prd.getTailKey());
        }
        evReturned = true;
        return ev;
    } finally {
        if (!evReturned) {
            ev.release();
        }
    }
}
Also used : Retained(org.apache.geode.internal.offheap.annotations.Retained) EntryEventImpl(org.apache.geode.internal.cache.EntryEventImpl) PutAllEntryData(org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData) Retained(org.apache.geode.internal.offheap.annotations.Retained)

Aggregations

PutAllEntryData (org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData)7 EntryVersionsList (org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList)5 ByteArrayDataInput (org.apache.geode.internal.ByteArrayDataInput)3 Version (org.apache.geode.internal.Version)3 EntryEventImpl (org.apache.geode.internal.cache.EntryEventImpl)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 CancelException (org.apache.geode.CancelException)1 CacheException (org.apache.geode.cache.CacheException)1 TransactionDataNotColocatedException (org.apache.geode.cache.TransactionDataNotColocatedException)1 CqService (org.apache.geode.cache.query.internal.cq.CqService)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 CopyOnWriteHashSet (org.apache.geode.internal.CopyOnWriteHashSet)1 DistributedPutAllOperation (org.apache.geode.internal.cache.DistributedPutAllOperation)1 FilterInfo (org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo)1 VersionedObjectList (org.apache.geode.internal.cache.tier.sockets.VersionedObjectList)1