Search in sources :

Example 1 with Retained

use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.

the class DummyQRegion method getValues.

@Override
public SelectResults getValues() {
    if (values == null) {
        values = new ResultsBag(((HasCachePerfStats) getRegion().getCache()).getCachePerfStats());
        values.setElementType(valueType);
    }
    values.clear();
    Object val = this.entry.getValueOffHeapOrDiskWithoutFaultIn((LocalRegion) getRegion());
    if (val instanceof StoredObject) {
        @Retained @Released StoredObject ohval = (StoredObject) val;
        try {
            val = ohval.getDeserializedValue(getRegion(), this.entry);
        } finally {
            ohval.release();
        }
    } else if (val instanceof CachedDeserializable) {
        val = ((CachedDeserializable) val).getDeserializedValue(getRegion(), this.entry);
    }
    values.add(val);
    return values;
}
Also used : Released(org.apache.geode.internal.offheap.annotations.Released) StoredObject(org.apache.geode.internal.offheap.StoredObject) Retained(org.apache.geode.internal.offheap.annotations.Retained) CachedDeserializable(org.apache.geode.internal.cache.CachedDeserializable) HasCachePerfStats(org.apache.geode.internal.cache.HasCachePerfStats) StoredObject(org.apache.geode.internal.offheap.StoredObject) ResultsBag(org.apache.geode.cache.query.internal.ResultsBag)

Example 2 with Retained

use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.

the class DummyQRegion method toArray.

@Override
public Object[] toArray() {
    if (valueInArray == null) {
        valueInArray = new Object[1];
    }
    Object val = this.entry.getValueOffHeapOrDiskWithoutFaultIn((LocalRegion) getRegion());
    if (val instanceof StoredObject) {
        @Retained @Released StoredObject ohval = (StoredObject) val;
        try {
            val = ohval.getDeserializedValue(getRegion(), this.entry);
        } finally {
            ohval.release();
        }
    } else if (val instanceof CachedDeserializable) {
        val = ((CachedDeserializable) val).getDeserializedValue(getRegion(), this.entry);
    }
    valueInArray[0] = val;
    return valueInArray;
}
Also used : Released(org.apache.geode.internal.offheap.annotations.Released) StoredObject(org.apache.geode.internal.offheap.StoredObject) Retained(org.apache.geode.internal.offheap.annotations.Retained) CachedDeserializable(org.apache.geode.internal.cache.CachedDeserializable) StoredObject(org.apache.geode.internal.offheap.StoredObject)

Example 3 with Retained

use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.

the class EntryEventImpl method putExistingEntry.

/**
   * Put a newValue into the given, write synced, existing, region entry. Sets oldValue in event if
   * hasn't been set yet.
   * 
   * @param oldValueForDelta Used by Delta Propagation feature
   */
void putExistingEntry(final LocalRegion owner, final RegionEntry reentry, boolean requireOldValue, Object oldValueForDelta) throws RegionClearedException {
    makeUpdate();
    // only set oldValue if it hasn't already been set to something
    if (this.oldValue == null) {
        if (!reentry.isInvalidOrRemoved()) {
            if (// fix for bug
            requireOldValue || EVENT_OLD_VALUE || this.region instanceof HARegion) // 37909
            {
                @Retained Object ov;
                if (ReferenceCountHelper.trackReferenceCounts()) {
                    ReferenceCountHelper.setReferenceCountOwner(new OldValueOwner());
                    ov = reentry._getValueRetain(owner, true);
                    ReferenceCountHelper.setReferenceCountOwner(null);
                } else {
                    ov = reentry._getValueRetain(owner, true);
                }
                if (ov == null)
                    ov = Token.NOT_AVAILABLE;
                // ov has already been retained so call basicSetOldValue instead of retainAndSetOldValue
                basicSetOldValue(ov);
            } else {
                basicSetOldValue(Token.NOT_AVAILABLE);
            }
        }
    }
    if (this.oldValue == Token.NOT_AVAILABLE) {
        FilterProfile fp = this.region.getFilterProfile();
        if (this.op.guaranteesOldValue() || (fp != null && /* #41532 */
        fp.entryRequiresOldValue(this.getKey()))) {
            setOldValueForQueryProcessing();
        }
    }
    // setNewValueInRegion(null);
    setNewValueInRegion(owner, reentry, oldValueForDelta);
}
Also used : Retained(org.apache.geode.internal.offheap.annotations.Retained) StoredObject(org.apache.geode.internal.offheap.StoredObject)

Example 4 with Retained

use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.

the class PutMessage method createListenerEvent.

// public final boolean needsDirectAck()
// {
// return this.directAck;
// }
// final public int getProcessorType() {
// return DistributionManager.PARTITIONED_REGION_EXECUTOR;
// }
/**
   * create a new EntryEvent to be used in notifying listeners, bridge servers, etc. Caller must
   * release result if it is != to sourceEvent
   */
@Retained
EntryEventImpl createListenerEvent(EntryEventImpl sourceEvent, PartitionedRegion r, InternalDistributedMember member) {
    final EntryEventImpl e2;
    if (this.notificationOnly && this.bridgeContext == null) {
        e2 = sourceEvent;
    } else {
        e2 = new EntryEventImpl(sourceEvent);
        if (this.bridgeContext != null) {
            e2.setContext(this.bridgeContext);
        }
    }
    e2.setRegion(r);
    e2.setOriginRemote(true);
    e2.setInvokePRCallbacks(!notificationOnly);
    if (!sourceEvent.hasOldValue()) {
        e2.oldValueNotAvailable();
    }
    if (this.filterInfo != null) {
        e2.setLocalFilterInfo(this.filterInfo.getFilterInfo(member));
    }
    if (this.versionTag != null) {
        this.versionTag.replaceNullIDs(getSender());
        e2.setVersionTag(this.versionTag);
    }
    return e2;
}
Also used : EntryEventImpl(org.apache.geode.internal.cache.EntryEventImpl) Retained(org.apache.geode.internal.offheap.annotations.Retained)

Example 5 with Retained

use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.

the class DestroyMessage method createListenerEvent.

/**
   * create a new EntryEvent to be used in notifying listeners, bridge servers, etc. Caller must
   * release result if it is != to sourceEvent
   */
@Retained
EntryEventImpl createListenerEvent(EntryEventImpl sourceEvent, PartitionedRegion r, InternalDistributedMember member) {
    final EntryEventImpl e2;
    if (this.notificationOnly && this.bridgeContext == null) {
        e2 = sourceEvent;
    } else {
        e2 = new EntryEventImpl(sourceEvent);
        if (this.bridgeContext != null) {
            e2.setContext(this.bridgeContext);
        }
    }
    e2.setRegion(r);
    e2.setOriginRemote(true);
    e2.setInvokePRCallbacks(!notificationOnly);
    if (this.filterInfo != null) {
        e2.setLocalFilterInfo(this.filterInfo.getFilterInfo(member));
    }
    if (this.versionTag != null) {
        this.versionTag.replaceNullIDs(getSender());
        e2.setVersionTag(this.versionTag);
    }
    return e2;
}
Also used : EntryEventImpl(org.apache.geode.internal.cache.EntryEventImpl) Retained(org.apache.geode.internal.offheap.annotations.Retained)

Aggregations

Retained (org.apache.geode.internal.offheap.annotations.Retained)33 StoredObject (org.apache.geode.internal.offheap.StoredObject)17 Released (org.apache.geode.internal.offheap.annotations.Released)9 VersionTag (org.apache.geode.internal.cache.versions.VersionTag)7 CachedDeserializable (org.apache.geode.internal.cache.CachedDeserializable)5 IOException (java.io.IOException)4 EntryEventImpl (org.apache.geode.internal.cache.EntryEventImpl)4 Unretained (org.apache.geode.internal.offheap.annotations.Unretained)4 Operation (org.apache.geode.cache.Operation)3 GetOperationContext (org.apache.geode.cache.operations.GetOperationContext)3 GetOperationContextImpl (org.apache.geode.cache.operations.internal.GetOperationContextImpl)3 QueryException (org.apache.geode.cache.query.QueryException)3 DistributedMember (org.apache.geode.distributed.DistributedMember)3 AuthorizeRequest (org.apache.geode.internal.security.AuthorizeRequest)3 AuthorizeRequestPP (org.apache.geode.internal.security.AuthorizeRequestPP)3 NotAuthorizedException (org.apache.geode.security.NotAuthorizedException)3 DiskAccessException (org.apache.geode.cache.DiskAccessException)2 IndexMaintenanceException (org.apache.geode.cache.query.IndexMaintenanceException)2 CqService (org.apache.geode.cache.query.internal.cq.CqService)2 IndexManager (org.apache.geode.cache.query.internal.index.IndexManager)2