@Override public void toData(DataOutput out) throws IOException { super.toData(out); out.writeBoolean(this.isHostingTx); boolean sendTXCommitMessage = this.txCommitMessage != null; out.writeBoolean(sendTXCommitMessage); if (sendTXCommitMessage) { out.writeBoolean(this.isPartialCommitMessage); // since this message is going to a peer, reset client version txCommitMessage.setClientVersion(null); // fixes bug 46529 InternalDataSerializer.writeDSFID(txCommitMessage, out); } }
/** * @throws IOException if serialization failure */ @Override public int writeMessage() throws IOException { // if (logger.isTraceEnabled()) logger.trace(this.msg); try { this.startedSerializingMsg = true; InternalDataSerializer.writeDSFID(this.msg, this); this.doneWritingMsg = true; if (this.flushedBytes == 0) { // message fit in one chunk this.normalMsg = true; } realFlush(true); return this.flushedBytes; } finally { release(); } }
@Test public void testDataSerializableFixedIDByte() throws IOException { DataSerializableFixedID value = new ReplyMessage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(baos); InternalDataSerializer.writeDSFID(value, out); byte[] bytes = baos.toByteArray(); String type = DataType.getDataType(bytes); assertEquals( "org.apache.geode.internal.DataSerializableFixedID:" + ReplyMessage.class.getName(), type); }
@Test public void testDataSerializableFixedIDShort() throws IOException { DataSerializableFixedID value = new ShutdownAllResponse(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(baos); InternalDataSerializer.writeDSFID(value, out); byte[] bytes = baos.toByteArray(); String type = DataType.getDataType(bytes); assertEquals( "org.apache.geode.internal.DataSerializableFixedID:" + ShutdownAllResponse.class .getName(), type); }
checkPdxCompatible(o, ensurePdxCompatibility); DataSerializableFixedID dsfid = (DataSerializableFixedID) o; writeDSFID(dsfid, out); } else if (autoSerialized(o, out)) {