use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.
the class BucketRegion method createEventForPR.
@Retained
EntryEventImpl createEventForPR(EntryEventImpl sourceEvent) {
EntryEventImpl e2 = new EntryEventImpl(sourceEvent);
boolean returned = false;
try {
e2.setRegion(this.partitionedRegion);
if (FORCE_LOCAL_LISTENERS_INVOCATION) {
e2.setInvokePRCallbacks(true);
} else {
e2.setInvokePRCallbacks(sourceEvent.getInvokePRCallbacks());
}
DistributedMember dm = this.getDistributionManager().getDistributionManagerId();
e2.setOriginRemote(!e2.getDistributedMember().equals(dm));
returned = true;
return e2;
} finally {
if (!returned) {
e2.release();
}
}
}
use of org.apache.geode.internal.offheap.annotations.Retained in project geode by apache.
the class AbstractRegionMap method createCBEvent.
/** create a callback event for applying a transactional change to the local cache */
@Retained
public static EntryEventImpl createCBEvent(final LocalRegion re, Operation op, Object key, Object newValue, TransactionId txId, TXRmtEvent txEvent, EventID eventId, Object aCallbackArgument, FilterRoutingInfo filterRoutingInfo, ClientProxyMembershipID bridgeContext, TXEntryState txEntryState, VersionTag versionTag, long tailKey) {
DistributedMember originator = null;
// txId should not be null even on localOrigin
Assert.assertTrue(txId != null);
originator = ((TXId) txId).getMemberId();
LocalRegion eventRegion = re;
if (eventRegion.isUsedForPartitionedRegionBucket()) {
eventRegion = re.getPartitionedRegion();
}
@Retained EntryEventImpl retVal = EntryEventImpl.create(re, op, key, newValue, aCallbackArgument, txEntryState == null, originator);
boolean returnedRetVal = false;
try {
if (bridgeContext != null) {
retVal.setContext(bridgeContext);
}
if (eventRegion.generateEventID()) {
retVal.setEventId(eventId);
}
if (versionTag != null) {
retVal.setVersionTag(versionTag);
}
retVal.setTailKey(tailKey);
FilterInfo localRouting = null;
boolean computeFilterInfo = false;
if (filterRoutingInfo == null) {
computeFilterInfo = true;
} else {
localRouting = filterRoutingInfo.getLocalFilterInfo();
if (localRouting != null) {
// routing was computed in this VM but may need to perform local interest processing
computeFilterInfo = !filterRoutingInfo.hasLocalInterestBeenComputed();
} else {
// routing was computed elsewhere and is in the "remote" routing table
localRouting = filterRoutingInfo.getFilterInfo(re.getMyId());
}
if (localRouting != null) {
if (!computeFilterInfo) {
retVal.setLocalFilterInfo(localRouting);
}
} else {
computeFilterInfo = true;
}
}
if (logger.isTraceEnabled()) {
logger.trace("createCBEvent filterRouting={} computeFilterInfo={} local routing={}", filterRoutingInfo, computeFilterInfo, localRouting);
}
if (re.isUsedForPartitionedRegionBucket()) {
BucketRegion bucket = (BucketRegion) re;
if (BucketRegion.FORCE_LOCAL_LISTENERS_INVOCATION || bucket.getBucketAdvisor().isPrimary()) {
retVal.setInvokePRCallbacks(true);
} else {
retVal.setInvokePRCallbacks(false);
}
if (computeFilterInfo) {
if (bucket.getBucketAdvisor().isPrimary()) {
if (logger.isTraceEnabled()) {
logger.trace("createCBEvent computing routing for primary bucket");
}
FilterProfile fp = ((BucketRegion) re).getPartitionedRegion().getFilterProfile();
if (fp != null) {
FilterRoutingInfo fri = fp.getFilterRoutingInfoPart2(filterRoutingInfo, retVal);
if (fri != null) {
retVal.setLocalFilterInfo(fri.getLocalFilterInfo());
}
}
}
}
} else if (computeFilterInfo) {
// not a bucket
if (logger.isTraceEnabled()) {
logger.trace("createCBEvent computing routing for non-bucket");
}
FilterProfile fp = re.getFilterProfile();
if (fp != null) {
retVal.setLocalFilterInfo(fp.getLocalFilterRouting(retVal));
}
}
retVal.setTransactionId(txId);
returnedRetVal = true;
return retVal;
} finally {
if (!returnedRetVal) {
retVal.release();
}
}
}
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);
}
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;
}
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;
}
Aggregations