public Object apply(EntryEvent ev) { if (ev != null && ev instanceof EntryEventImpl) { EntryEventImpl putEvent = (EntryEventImpl)ev; int last = this.listOfDeltas.size() -1; for (int i = this.deltaAppliedIndex; i < listOfDeltas.size(); i++) { Object o = listOfDeltas.get(i).apply(putEvent); if(i < last) { putEvent.setOldValue(o); }else { putEvent.setNewValue(o); } } return putEvent.getNewValue(); } else { throw new InternalGemFireException( "ListOfDeltas.apply: putEvent is either null " + "or is not of type EntryEventImpl"); } }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.skipListeners = (flags & SKIP_LISTENERS) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { this.cbArg = new GfxdCBArgForSynchPrms(); InternalDataSerializer.invokeFromData(this.cbArg, in); event.setNewValue(Token.INVALID); event.setCallbackArgument(this.cbArg); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
public CacheLoadedDBSynchronizerMessage(LocalRegion rgn, Object key, Object value, boolean isTransactional) { super(rgn); this.transactional = isTransactional; EntryEventImpl event = this.getEntryEventImpl(); // TODO OFFHEAP: for now disallow off-heap. If it turns out value can be off-heap then we need to track the lifetime of CacheLoadedDBSynchronizerMessage. event.disallowOffHeapValues(); event.setKey(key); event.setNewValue(value); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, isTransactional, false, true, true, true, false, false)); }
public CacheLoadedDBSynchronizerMessage(LocalRegion rgn, Object key, Object value, boolean isTransactional) { super(rgn); this.transactional = isTransactional; EntryEventImpl event = this.getEntryEventImpl(); // TODO OFFHEAP: for now disallow off-heap. If it turns out value can be off-heap then we need to track the lifetime of CacheLoadedDBSynchronizerMessage. event.disallowOffHeapValues(); event.setKey(key); event.setNewValue(value); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, isTransactional, false, true, true, true, false, false)); }
public CacheLoadedDBSynchronizerMessage(LocalRegion rgn, Object key, Object value, boolean isTransactional) { super(rgn); this.transactional = isTransactional; EntryEventImpl event = this.getEntryEventImpl(); // TODO OFFHEAP: for now disallow off-heap. If it turns out value can be off-heap then we need to track the lifetime of CacheLoadedDBSynchronizerMessage. event.disallowOffHeapValues(); event.setKey(key); event.setNewValue(value); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, isTransactional, false, true, true, true, false, false)); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.skipListeners = (flags & SKIP_LISTENERS) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { this.cbArg = new GfxdCBArgForSynchPrms(); InternalDataSerializer.invokeFromData(this.cbArg, in); event.setNewValue(Token.INVALID); event.setCallbackArgument(this.cbArg); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.skipListeners = (flags & SKIP_LISTENERS) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { this.cbArg = new GfxdCBArgForSynchPrms(); InternalDataSerializer.invokeFromData(this.cbArg, in); event.setNewValue(Token.INVALID); event.setCallbackArgument(this.cbArg); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
public Object apply(final EntryEvent<?, ?> ev) { if (ev != null && ev instanceof EntryEventImpl) { final EntryEventImpl putEvent = (EntryEventImpl)ev; final Object newValue = apply(putEvent.getRegion(), putEvent.getKey(), putEvent.getOldValueAsOffHeapDeserializedOrRaw(), false); putEvent.setNewValue(newValue); return newValue; } else { throw new InternalGemFireError( "ListOfDeltas.apply: putEvent is either null " + "or is not of type EntryEventImpl: " + ev); } }
public BulkDBSynchronizerMessage(LocalRegion rgn, String dmlString, boolean skipListeners, GfxdCBArgForSynchPrms arg) throws StandardException { super(rgn); this.cbArg = arg; // setting Token.INVALID rather than null since old code relied on // this.cbArg being set there and need to make sure that we are no longer // relying on value carrying this.cbArg (i.e. we get a ClassCastException // somewhere otherwise) this.getEntryEventImpl().setNewValue(Token.INVALID); this.getEntryEventImpl().setCallbackArgument(this.cbArg); this.getEntryEventImpl().disallowOffHeapValues(); this.skipListeners = skipListeners; }
public BulkDBSynchronizerMessage(LocalRegion rgn, String dmlString, boolean skipListeners, GfxdCBArgForSynchPrms arg) throws StandardException { super(rgn); this.cbArg = arg; // setting Token.INVALID rather than null since old code relied on // this.cbArg being set there and need to make sure that we are no longer // relying on value carrying this.cbArg (i.e. we get a ClassCastException // somewhere otherwise) this.getEntryEventImpl().setNewValue(Token.INVALID); this.getEntryEventImpl().setCallbackArgument(this.cbArg); this.getEntryEventImpl().disallowOffHeapValues(); this.skipListeners = skipListeners; }
public BulkDBSynchronizerMessage(LocalRegion rgn, String dmlString, boolean skipListeners, GfxdCBArgForSynchPrms arg) throws StandardException { super(rgn); this.cbArg = arg; // setting Token.INVALID rather than null since old code relied on // this.cbArg being set there and need to make sure that we are no longer // relying on value carrying this.cbArg (i.e. we get a ClassCastException // somewhere otherwise) this.getEntryEventImpl().setNewValue(Token.INVALID); this.getEntryEventImpl().setCallbackArgument(this.cbArg); this.getEntryEventImpl().disallowOffHeapValues(); this.skipListeners = skipListeners; }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.transactional = (flags & IS_TRANSACTIONAL) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { event.disallowOffHeapValues(); event.setKey(DataSerializer.readObject(in)); event.setNewValue(DataSerializer.readObject(in)); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, this.transactional, false, true, true,true, false, false)); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.transactional = (flags & IS_TRANSACTIONAL) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { event.disallowOffHeapValues(); event.setKey(DataSerializer.readObject(in)); event.setNewValue(DataSerializer.readObject(in)); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, this.transactional, false, true, true,true, false, false)); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.transactional = (flags & IS_TRANSACTIONAL) != 0; try { // Read EventID EntryEventImpl event = this.getEntryEventImpl(); if (event != null) { event.disallowOffHeapValues(); event.setKey(DataSerializer.readObject(in)); event.setNewValue(DataSerializer.readObject(in)); event.setCallbackArgument(GemFireXDUtils.wrapCallbackArgs(null, null, this.transactional, false, true, true,true, false, false)); } } catch (IOException ioe) { throw ioe; } catch (Exception e) { throw new IOException(e); } }
private EntryEventImpl createEventForErrorLog(int batchId, LocalRegion region, EntryEventImpl clientEvent, Operation op, Object key, Object value, Part valuePart, boolean isObject, Object callbackArg, ClientProxyMembershipID client, EventID eventId) { EntryEventImpl logEvent = null; // Exceptions, if any (such as during serialization), creating the log event // should not disrupt the batch processing. So catch them and log them. try { logEvent = EntryEventImpl.create(region, op, key, value, callbackArg, false, client.getDistributedMember(), true, eventId); logEvent.setVersionTag(clientEvent.getVersionTag()); logEvent.setPossibleDuplicate(clientEvent.isPossibleDuplicate()); if (value != null) { if (isObject && value instanceof byte[]) { logEvent.setSerializedNewValue((byte[])value); } else { logEvent.setNewValue(value); } } } catch (Exception e) { if (logger.warningEnabled()) { logger.warning(LocalizedStrings.FAILED_TO_CREATE_LOG_EVENT_0_1_2_3_4, new Object[] { new Integer(batchId), eventId, op, key, valuePart }); } } return logEvent; }
private EntryEventImpl createNewEvent(LocalRegion region, VersionTag tag, Object key, Object value) { EntryEventImpl updateEvent = EntryEventImpl.createVersionTagHolder(tag); updateEvent.setOperation(Operation.UPDATE); updateEvent.setRegion(region); if (region instanceof PartitionedRegion) { updateEvent.setKeyInfo(((PartitionedRegion)region).getKeyInfo(key)); } else { updateEvent.setKeyInfo(new KeyInfo(key, value, null)); } updateEvent.setNewValue(value); updateEvent.setGenerateCallbacks(true); updateEvent.distributedMember = region.getSystem().getDistributedMember(); updateEvent.setNewEventId(region.getSystem()); return updateEvent; }
EntryEventImpl event = EntryEventImpl.create(dr, Operation.CREATE, "Object3", true, forMember, true, false); getLogWriter().info("applying this event to the cache: " + event); event.setNewValue(new VMCachedDeserializable("value3", 12)); event.setVersionTag(tag); dr.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false); tag.setIsRemoteForTesting(); event = EntryEventImpl.create(dr, Operation.CREATE, "Object5", true, forMember, true, false); event.setNewValue(Token.TOMBSTONE); event.setVersionTag(tag); getLogWriter().info("applying this event to the cache: " + event);
ev.setNewValue(this.newValueObj);
if (scope.isLocal()) { Object obj = doLocalLoad(loader, false); event.setNewValue(obj);
if (scope.isLocal()) { Object obj = doLocalLoad(loader, false); event.setNewValue(obj);