use of org.apache.geode.internal.offheap.annotations.Unretained in project geode by apache.
the class LocalRegion method postRemoveAllFireEvents.
public void postRemoveAllFireEvents(DistributedRemoveAllOperation removeAllOp, VersionedObjectList successfulOps) {
if (!this.dataPolicy.withStorage() && this.concurrencyChecksEnabled && removeAllOp.getBaseEvent().isBridgeEvent()) {
// if there is no local storage we need to transfer version information
// to the successfulOps list for transmission back to the client
successfulOps.clear();
removeAllOp.fillVersionedObjectList(successfulOps);
}
Set successfulKeys = new HashSet(successfulOps.size());
for (Object key : successfulOps.getKeys()) {
successfulKeys.add(key);
}
for (Iterator it = removeAllOp.eventIterator(); it.hasNext(); ) {
@Unretained EntryEventImpl event = (EntryEventImpl) it.next();
if (successfulKeys.contains(event.getKey())) {
invokeDestroyCallbacks(EnumListenerEvent.AFTER_DESTROY, event, !event.callbacksInvoked() && !event.isPossibleDuplicate(), this.isUsedForPartitionedRegionBucket);
}
}
}
use of org.apache.geode.internal.offheap.annotations.Unretained in project geode by apache.
the class GatewaySenderEventImpl method getSerializedValue.
/**
* If the value owned of this event is just bytes return that byte array; otherwise serialize the
* value object and return the serialized bytes. Use {@link #getValueIsObject()} to determine if
* the result is raw or serialized bytes.
*/
public byte[] getSerializedValue() {
byte[] result = this.value;
if (result == null) {
if (this.substituteValue != null) {
// The substitute value is set. Serialize it
isSerializingValue.set(Boolean.TRUE);
result = EntryEventImpl.serialize(this.substituteValue);
isSerializingValue.set(Boolean.FALSE);
return result;
}
@Unretained(OffHeapIdentifier.GATEWAY_SENDER_EVENT_IMPL_VALUE) Object vo = this.valueObj;
if (vo instanceof StoredObject) {
synchronized (this) {
result = this.value;
if (result == null) {
StoredObject so = (StoredObject) vo;
result = so.getValueAsHeapByteArray();
this.value = result;
}
}
} else {
synchronized (this) {
result = this.value;
if (result == null && vo != null && !(vo instanceof Token)) {
isSerializingValue.set(Boolean.TRUE);
result = EntryEventImpl.serialize(vo);
isSerializingValue.set(Boolean.FALSE);
this.value = result;
} else if (result == null) {
if (this.valueObjReleased) {
this.serializedValueNotAvailable = true;
throw new IllegalStateException("Value is no longer available. getSerializedValue must be called before processEvents returns.");
}
}
}
}
}
return result;
}
Aggregations