public void addBytesPart(byte[] newPart) { addRawPart(newPart, false); }
public void addObjPart(Object o, boolean zipValues) { if (o == null || o instanceof byte[]) { addRawPart((byte[]) o, false); } else if (o instanceof Boolean) { addRawPart((Boolean) o ? TRUE : FALSE, true); } else { serializeAndAddPart(o, zipValues); } }
/** * @throws org.apache.geode.SerializationException if serialization fails */ public CloseConnectionOpImpl(boolean keepAlive) { super(MessageType.CLOSE_CONNECTION, 1); getMessage().addRawPart(new byte[] {(byte) (keepAlive ? 1 : 0)}, false); }
/** * Like addObjPart(Object) but also prefers to reference objects in the part instead of copying * them into a byte buffer. */ public void addObjPartNoCopying(Object o) { if (o == null || o instanceof byte[]) { addRawPart((byte[]) o, false); } else { serializeAndAddPartNoCopying(o); } }
/** * Object o is always null */ public void addPartInAnyForm(@Unretained Object o, boolean isObject) { if (o == null) { addRawPart((byte[]) o, false); } else if (o instanceof byte[]) { addRawPart((byte[]) o, isObject); } else if (o instanceof StoredObject) { // It is possible it is an off-heap StoredObject that contains a simple non-object byte[]. this.messageModified = true; Part part = this.partsList[this.currentPart]; part.setPartState((StoredObject) o, isObject); this.currentPart++; } else { serializeAndAddPart(o, false); } }
public void addStringPart(String str, boolean enableCaching) { if (str == null) { addRawPart(null, false); return; } Part part = this.partsList[this.currentPart]; if (enableCaching) { byte[] bytes = CACHED_STRINGS.get(str); if (bytes == null) { try (HeapDataOutputStream hdos = new HeapDataOutputStream(str)) { bytes = hdos.toByteArray(); CACHED_STRINGS.put(str, bytes); } } part.setPartState(bytes, false); } else { // do NOT close the HeapDataOutputStream this.messageModified = true; part.setPartState(new HeapDataOutputStream(str), false); } this.currentPart++; }
Object cdValue = cd.getValue(); if (cdValue instanceof byte[]) { getMessage().addRawPart((byte[]) cdValue, true); } else { getMessage().addObjPart(cdValue);
protected static void writeResponse(Object data, Object callbackArg, Message origMsg, boolean isObject, ServerConnection serverConnection) throws IOException { Message responseMsg = serverConnection.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); if (callbackArg == null) { responseMsg.setNumberOfParts(1); } else { responseMsg.setNumberOfParts(2); } if (data instanceof byte[]) { responseMsg.addRawPart((byte[]) data, isObject); } else { Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]"); responseMsg.addObjPart(data, false); } if (callbackArg != null) { responseMsg.addObjPart(callbackArg); } serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(serverConnection); origMsg.clearParts(); }
message.addRawPart(latestValue, (this._valueIsObject == 0x01)); message.addObjPart(this._callbackArgument); message.addObjPart(Boolean.valueOf(isClientInterested(proxyId)));
protected static void writeResponseWithRefreshMetadata(Object data, Object callbackArg, Message origMsg, boolean isObject, ServerConnection serverConnection, PartitionedRegion pr, byte nwHop) throws IOException { Message responseMsg = serverConnection.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); if (callbackArg == null) { responseMsg.setNumberOfParts(2); } else { responseMsg.setNumberOfParts(3); } if (data instanceof byte[]) { responseMsg.addRawPart((byte[]) data, isObject); } else { Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]"); responseMsg.addObjPart(data, false); } if (callbackArg != null) { responseMsg.addObjPart(callbackArg); } responseMsg.addBytesPart(new byte[] {pr.getMetadataVersion(), nwHop}); serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null); responseMsg.send(serverConnection); origMsg.clearParts(); }
byte valueIsObject = event.getValueIsObject();; getMessage().addRawPart(value, (valueIsObject == 0x01));
message.addRawPart(latestValue, (this._valueIsObject == 0x01)); } else { message.setMessageType(MessageType.LOCAL_UPDATE); message.addRawPart(l, (this._valueIsObject == 0x01));
message.addRawPart(latestValue, (this._valueIsObject == 0x01)); } else { message.setMessageType(MessageType.LOCAL_UPDATE); message.addRawPart(latestValue, (this._valueIsObject == 0x01));
Object cdValue = cd.getValue(); if (cdValue instanceof byte[]) { getMessage().addRawPart((byte[]) cdValue, true); } else { getMessage().addObjPart(cdValue);
message.addRawPart(latestValue, (this._valueIsObject == 0x01)); } else { message.setMessageType(MessageType.LOCAL_UPDATE); message.addRawPart(latestValue, (this._valueIsObject == 0x01));
Object cdValue = cd.getValue(); if (cdValue instanceof byte[]) { getMessage().addRawPart((byte[]) cdValue, true); } else { getMessage().addObjPart(cdValue);