/** * Write this {@link Version}'s ordinal (result of {@link #ordinal()}) to given * {@link DataOutput}. This keeps the serialization of ordinal compatible with previous versions * writing a single byte to DataOutput when possible, and a token with 2 bytes if it is large. * * @param out the {@link DataOutput} to write the ordinal write to * @param compressed if true, then use single byte for ordinal < 128, and three bytes for beyond * that, else always use three bytes where the first byte is {@link #TOKEN_ORDINAL}; former * mode is useful for interoperatibility with previous versions while latter to use fixed * size for writing version; typically former will be used for P2P/client-server * communications while latter for persisting to disk; we use the token to ensure that * {@link #readOrdinal(DataInput)} can deal with both compressed/uncompressed cases * seemlessly */ public void writeOrdinal(DataOutput out, boolean compressed) throws IOException { writeOrdinal(out, this.ordinal, compressed); }
private void writeOrdinal(OplogFile olf, short ordinal) throws IOException { ByteBuffer bb = olf.writeBuf; if (3 > bb.remaining()) { flushNoSync(olf); } // don't compress since we setup fixed size of buffers Version.writeOrdinal(bb, ordinal, false); }
public void writeEssentialData(DataOutput out) throws IOException { Version.writeOrdinal(out, this.versionOrdinal, true); int flags = 0; if (networkPartitionDetectionEnabled) flags |= NPD_ENABLED_BIT; if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD_BIT; out.writeShort(flags); DataSerializer.writeInetAddress(inetAddr, out); out.writeInt(udpPort); out.writeInt(vmViewId); out.writeLong(uuidMSBs); out.writeLong(uuidLSBs); if (InternalDataSerializer.getVersionForDataStream(out).compareTo(Version.GEODE_120) >= 0) { out.writeByte(vmKind); } }
private void sendOKHandshakeReply() throws IOException, ConnectionException { ByteBuffer my_okHandshakeBuf; if (this.isReceiver) { DistributionConfig cfg = owner.getConduit().config; ByteBuffer bb; if (Buffers.useDirectBuffers) { bb = ByteBuffer.allocateDirect(128); } else { bb = ByteBuffer.allocate(128); } bb.putInt(0); // reserve first 4 bytes for packet length bb.put((byte) NORMAL_MSG_TYPE); bb.putShort(MsgIdGenerator.NO_MSG_ID); bb.put(REPLY_CODE_OK_WITH_ASYNC_INFO); bb.putInt(cfg.getAsyncDistributionTimeout()); bb.putInt(cfg.getAsyncQueueTimeout()); bb.putInt(cfg.getAsyncMaxQueueSize()); // write own product version Version.writeOrdinal(bb, Version.CURRENT.ordinal(), true); // now set the msg length into position 0 bb.putInt(0, calcHdrSize(bb.position() - MSG_HEADER_BYTES)); my_okHandshakeBuf = bb; bb.flip(); } else { my_okHandshakeBuf = okHandshakeBuf; } my_okHandshakeBuf.position(0); writeFully(getSocket().getChannel(), my_okHandshakeBuf, false, null); }
this.gfversion.writeOrdinal(this.krf.dos, false); } else { Version.TOKEN.writeOrdinal(this.krf.dos, false); this.krf.dos.writeByte(END_OF_RECORD_ID); this.krf.dos.writeByte(OPLOG_GEMFIRE_VERSION); this.gfversion.writeOrdinal(this.krf.dos, false); this.krf.dos.writeByte(END_OF_RECORD_ID); this.krf.dos.writeByte(OPLOG_GEMFIRE_VERSION); dataVersion.writeOrdinal(this.krf.dos, false);
private void writeGemfireVersion(Version version) { lock(true); try { ByteBuffer bb = getIFWriteBuffer(1 + 3 + 1); bb.put(IFREC_GEMFIRE_VERSION); Version.writeOrdinal(bb, version.ordinal(), false); bb.put(END_OF_RECORD_ID); writeIFRecord(bb, false); // don't do stats for these small records } catch (IOException ex) { DiskAccessException dae = new DiskAccessException( String.format("Failed writing data to initialization file because: %s", ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } finally { unlock(true); } }
DataSerializer.writeInteger(Integer.valueOf(attributes == null ? 300 : attributes.getTimeout()), out); Version.writeOrdinal(out, netMbr.getVersionOrdinal(), true); netMbr.writeAdditionalData(out);
Version.writeOrdinal(out, version, true);
if (overrideClientVersion > 0) { Version.writeOrdinal(hdos, overrideClientVersion, true); } else { Version.writeOrdinal(hdos, currentClientVersion.ordinal(), true);
Version.writeOrdinal(dos, currentServerVersion.ordinal(), true);
HeapDataOutputStream out_stream = new HeapDataOutputStream(Version.fromOrdinalOrCurrent(version)); Version.CURRENT.writeOrdinal(out_stream, true); if (encrypt != null) { out_stream.writeBoolean(true);
connectHandshake.writeLong(this.uniqueId); Version.CURRENT.writeOrdinal(connectHandshake, true); connectHandshake.writeInt(dominoCount.get() + 1);