@Override public boolean isClientInterested(ClientProxyMembershipID clientId) { return Acceptor.VERSION.compareTo(Version.GFE_70) >= 0; }
public static String toString(short ordinal) { if (ordinal <= CURRENT.ordinal) { try { return fromOrdinal(ordinal, false).toString(); } catch (UnsupportedVersionException uve) { // ignored in toString() } } return "UNKNOWN[ordinal=" + ordinal + ']'; }
/** * Finds the Version instance corresponding to the given ordinal and returns * the result of compareTo(Version) * @param other the ordinal of the other Version object * @return negative if this version is older, positive if this version is newer, 0 if this is the same version */ public final int compareTo(short other) { // first try to find the actual Version object Version v = fromOrdinalNoThrow(other, false); if (v == null) { // failing that we use the old method of comparing Versions: return this.ordinal() - other; } return compareTo(v); }
/** * Return the <code>Version</code> reading from given {@link DataInput} as * serialized by {@link #writeOrdinal(DataOutput, boolean)}. * * If the incoming ordinal is greater than or equal to current ordinal then * this will return null or {@link #CURRENT} indicating that version is same * as that of {@link #CURRENT} assuming that peer will support this JVM. * * This method is not meant to be used for client-server protocol since * servers cannot support higher version clients, rather is only meant for * P2P/JGroups messaging where a mixed version of servers can be running at * the same time. Similarly cannot be used when recovering from disk since * higher version data cannot be read. * * @param in * the {@link DataInput} to read the version from * @param returnNullForCurrent * if true then return null if incoming version >= {@link #CURRENT} * else return {@link #CURRENT} */ public static Version readVersion(DataInput in, boolean returnNullForCurrent) throws IOException { return fromOrdinalNoThrow(readOrdinal(in), returnNullForCurrent); }
DataOutputStream dos = new DataOutputStream(out); DataInputStream dis; if (clientVersion.compareTo(Version.CURRENT) < 0) { dis = new VersionedDataInputStream(in, clientVersion); dos = new VersionedDataOutputStream(dos, clientVersion); Version.writeOrdinal(dos, ServerHandShakeProcessor.currentServerVersion.ordinal(), true); && this.clientVersion.compareTo(Version.GFE_61) >= 0) { dos.writeBoolean(((InternalDistributedSystem)this.system).getConfig() .getDeltaPropagation()); && this.clientVersion.compareTo(Version.GFE_66) >= 0 && ServerHandShakeProcessor.currentServerVersion.compareTo(Version.GFE_66) >= 0) { dos.writeByte(((InternalDistributedSystem)this.system) .getDistributionManager().getDistributedSystemId()); && this.clientVersion.compareTo(Version.GFE_80) >= 0 && ServerHandShakeProcessor.currentServerVersion.compareTo(Version.GFE_80) >= 0) { int pdxSize = PeerTypeRegistration.getPdxRegistrySize(); dos.writeInt(pdxSize);
/** * Constructs a DSFIDNotFoundException object with message string. * * @param msg * exception message */ public DSFIDNotFoundException(String msg, int dsfid) { super(msg); this.dsfid = dsfid; this.versionOrdinal = Version.CURRENT.ordinal(); }
private void readVersion(int flags, DataInput in) throws IOException { if ((flags & VERSION_MASK) != 0) { this.version = Version.readOrdinal(in); this.versionObj = Version.fromOrdinalNoThrow(this.version, false); } else { // prior to 7.1 member IDs did not serialize their version information Version v = InternalDataSerializer.getVersionForDataStreamOrNull(in); if (v != null) { this.versionObj = v; this.version = v.ordinal(); } } }
short clientVersionOrdinal = Version.readOrdinal(dis); Version clientVersion = null; try { clientVersion = Version.fromOrdinal(clientVersionOrdinal, true); if (logger.isDebugEnabled()) { logger.debug("{}: Registering client with version: {}", this, clientVersion); if (Version.GFE_57.compareTo(clientVersion) <= 0) { if (Version.CURRENT.compareTo(clientVersion) > 0) { dis = new VersionedDataInputStream(dis, clientVersion); dos = new VersionedDataOutputStream(dos, clientVersion);
if (Version.GFE_71.compareTo(serverVersion) > 0) { gossipVersion = TcpServer.getOldGossipVersion(); out = new VersionedDataOutputStream(out, Version.fromOrdinalNoThrow(serverVersion, false)); in = new VersionedDataInputStream(in, Version.fromOrdinal(serverVersion, false)); try { Object response = DataSerializer.readObject(in);
socket.setSoTimeout(timeout); short clientVersionOrdinal = Version.readOrdinalFromInputStream(is); if (clientVersionOrdinal == -1) { throw new EOFException( clientVersion = Version.fromOrdinal(clientVersionOrdinal, true); if (!clientVersion.compatibleWith(Acceptor.VERSION)) { throw new IncompatibleVersionException(clientVersion, Acceptor.VERSION);//we can throw this to restrict
(acceptanceCode == REPLY_EXCEPTION_AUTHENTICATION_REQUIRED || acceptanceCode == REPLY_EXCEPTION_AUTHENTICATION_FAILED)) { short wanSiteVersion = Version.readOrdinal(dis); conn.setWanSiteVersion(wanSiteVersion); dis = new VersionedDataInputStream(dis, Version.fromOrdinalOrCurrent(wanSiteVersion)); && currentClientVersion.compareTo(Version.GFE_61) >= 0) { deltaEnabledOnServer = dis.readBoolean(); && Version.GFE_66.compareTo(conn.getWanSiteVersion()) <= 0 && currentClientVersion.compareTo(Version.GFE_66) >= 0) { int remoteDistributedSystemId = in.read(); int localDistributedSystemId = ((InternalDistributedSystem) system).getDistributionManager().getDistributedSystemId(); && Version.GFE_80.compareTo(conn.getWanSiteVersion()) <= 0 && currentClientVersion.compareTo(Version.GFE_80) >= 0) { int remotePdxSize = dis.readInt(); serverQStatus.setPdxSize(remotePdxSize);
private Version readProductVersionRecord(DataInput dis, File f) throws IOException { Version recoveredGFVersion; short ver = Version.readOrdinal(dis); try { recoveredGFVersion = Version.fromOrdinal(ver, false); } catch (UnsupportedVersionException e) { throw new DiskAccessException(LocalizedStrings.Oplog_UNEXPECTED_PRODUCT_VERSION_0.toLocalizedString(ver), e, getParent()); } logger.trace(LogMarker.PERSIST_RECOVERY, "version={}", recoveredGFVersion); readEndOfRecord(dis); return recoveredGFVersion; }
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(); } } }
for (int i = 0; i < versions.length; i++) { if (v.compareTo(versions[i]) < 0) { ds.getClass() .getMethod( "fromDataPre" + "_" + versions[i].getMethodSuffix(), new Class[] { DataInput.class }).invoke(ds, in); invoked = true;
private void _readEssentialData(DataInput in) throws IOException, ClassNotFoundException { this.isPartial = true; InetAddress inetAddr = DataSerializer.readInetAddress(in); int port = in.readInt(); this.hostName = SocketCreator.resolve_dns? SocketCreator.getHostName(inetAddr) : inetAddr.getHostAddress(); int flags = in.readUnsignedByte(); boolean sbEnabled = (flags & SB_ENABLED_MASK) != 0; boolean elCoord = (flags & COORD_ENABLED_MASK) != 0; this.vmKind = in.readUnsignedByte(); if (this.vmKind == DistributionManager.LONER_DM_TYPE) { this.uniqueTag = DataSerializer.readString(in); } else { String str = DataSerializer.readString(in); if (str != null) { // backward compatibility from earlier than 6.5 this.vmViewId = Integer.parseInt(str); } } this.name = DataSerializer.readString(in); MemberAttributes attr = new MemberAttributes(this.dcPort, this.vmPid, this.vmKind, this.vmViewId, this.name, this.groups, this.durableClientAttributes); netMbr = MemberFactory.newNetMember(inetAddr, port, sbEnabled, elCoord, InternalDataSerializer.getVersionForDataStream(in).ordinal(), attr); synchPayload(); if (InternalDataSerializer.getVersionForDataStream(in).compareTo(Version.GFE_90)>=0) { netMbr.readAdditionalData(in); } }
if (Version.GFE_71.compareTo(versionOrdinal) <= 0) { versionOrdinal = input.readShort(); log.debug("Locator reading request from " + sock.getInetAddress() + " with version " + Version.fromOrdinal(versionOrdinal, false)); input = new VersionedDataInputStream(input, Version.fromOrdinal( versionOrdinal, false)); request = DataSerializer.readObject(input); DataOutputStream output = new DataOutputStream(sock.getOutputStream()); if (versionOrdinal != Version.CURRENT_ORDINAL) { output = new VersionedDataOutputStream(output, Version.fromOrdinal(versionOrdinal, false));
InternalDistributedMember mbr = it.next().getKey(); Version itsVersion = mbr.getVersionObject(); if (itsVersion != null && version.compareTo(itsVersion) < 0) { version = itsVersion; if (itsVersion != null && itsVersion.compareTo(version) < 0) { version = mbr.getVersionObject(); disableMulticastForRollingUpgrade = !version.equals(Version.CURRENT);
long start = services.getStatistics().startMsgSerialization(); 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);
/** * Test hook for server version support * * @since 5.7 */ public static void setSeverVersionForTesting(short ver) { currentServerVersion = Version.fromOrdinalOrCurrent(ver); }