/** * 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 final void writeOrdinal(DataOutput out, boolean compressed) throws IOException { writeOrdinal(out, this.ordinal, compressed); }
private final 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); }
@Override public void toData(DataOutput out) throws IOException { Version.writeOrdinal(out, this.versionOrdinal, true); int flags = 0; if (splitBrainEnabled) flags |= SB_ENABLED; if (preferredForCoordinator) flags |= PREFERRED_FOR_COORD; out.writeShort(flags); DataSerializer.writeInetAddress(inetAddr, out); out.writeInt(udpPort); out.writeInt(vmViewId); out.writeInt(directPort); out.writeByte(memberWeight); out.writeByte(vmKind); out.writeInt(processId); DataSerializer.writeString(name, out); DataSerializer.writeStringArray(groups, out); out.writeLong(uuidMSBs); out.writeLong(uuidLSBs); }
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);
os.writeBoolean(this.preserveOrder); os.writeLong(this.uniqueId); Version.CURRENT.writeOrdinal(os, true); os.writeInt(dominoCount.get()+1);
bb.putInt(cfg.getAsyncMaxQueueSize()); Version.writeOrdinal(bb, Version.CURRENT.ordinal(), true);
DataSerializer.writeString(this.durableClientAttributes==null ? "" : this.durableClientAttributes.getId(), out); DataSerializer.writeInteger(Integer.valueOf(this.durableClientAttributes==null ? 300 : this.durableClientAttributes.getTimeout()), out); Version.writeOrdinal(out, this.version, true); netMbr.writeAdditionalData(out);
private void writeGemfireVersion(Version version) { lock.lock(); 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(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } finally { lock.unlock(); } } }
Version.writeOrdinal(out, this.version, true);
Version.writeOrdinal(dos, ServerHandShakeProcessor.currentServerVersion.ordinal(), true);
if (overrideClientVersion > 0) { Version.writeOrdinal(hdos, overrideClientVersion, true); } else { Version.writeOrdinal(hdos, currentClientVersion.ordinal(), true);
connectHandshake.writeLong(this.uniqueId); Version.CURRENT.writeOrdinal(connectHandshake, true); connectHandshake.writeInt(dominoCount.get()+1);
HeapDataOutputStream out_stream = new HeapDataOutputStream(Version.fromOrdinalOrCurrent(version)); Version.CURRENT.writeOrdinal(out_stream, true); DataSerializer.writeObject(this.localAddress.getNetMember(), out_stream); DataSerializer.writeObject(gfmsg, out_stream);