use of org.apache.geode.internal.Version in project geode by apache.
the class ReplyProcessor21 method processException.
/**
* Handle a {@link DSFIDNotFoundException} indicating a message type is not implemented on another
* server (for example due to different product version). Default implementation logs the
* exception as severe and moves on.
*
* Rationale for default handling: New operations can have caused changes to other newer versioned
* GFE JVMs that cannot be reverted. So ignoring exceptions is a conservative way considering such
* scenarios. It will be upto individual messages to handle differently by overriding the above
* method.
*/
protected synchronized void processException(DistributionMessage msg, DSFIDNotFoundException ex) {
final short versionOrdinal = ex.getProductVersionOrdinal();
String versionStr = null;
try {
Version version = Version.fromOrdinal(versionOrdinal, false);
versionStr = version.toString();
} catch (UnsupportedVersionException e) {
}
if (versionStr == null) {
versionStr = "Ordinal=" + versionOrdinal;
}
logger.fatal(LocalizedMessage.create(LocalizedStrings.ReplyProcessor21_UNKNOWN_DSFID_ERROR, new Object[] { ex.getUnknownDSFID(), msg.getSender(), versionStr }), ex);
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ServerHandShakeProcessor method writeServerMember.
// Keep the writeServerMember/readServerMember compatible with C++ native
// client
protected static void writeServerMember(DistributedMember member, DataOutputStream dos) throws IOException {
Version v = Version.CURRENT;
if (dos instanceof VersionedDataStream) {
v = ((VersionedDataStream) dos).getVersion();
}
HeapDataOutputStream hdos = new HeapDataOutputStream(v);
DataSerializer.writeObject(member, hdos);
DataSerializer.writeByteArray(hdos.toByteArray(), dos);
hdos.close();
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ServerHandShakeProcessor method readHandShake.
public static boolean readHandShake(ServerConnection connection) {
boolean validHandShake = false;
Version clientVersion = null;
try {
// Read the version byte from the socket
clientVersion = readClientVersion(connection);
} catch (IOException e) {
// Only log an exception if the server is still running.
if (connection.getAcceptor().isRunning()) {
// Server logging
logger.warn("{} {}", connection.getName(), e.getMessage(), e);
}
connection.stats.incFailedConnectionAttempts();
connection.cleanup();
validHandShake = false;
} catch (UnsupportedVersionException uve) {
// Server logging
logger.warn("{} {}", connection.getName(), uve.getMessage(), uve);
// Client logging
connection.refuseHandshake(uve.getMessage(), REPLY_REFUSED);
connection.stats.incFailedConnectionAttempts();
connection.cleanup();
validHandShake = false;
} catch (Exception e) {
// Server logging
logger.warn("{} {}", connection.getName(), e.getMessage(), e);
// Client logging
connection.refuseHandshake(LocalizedStrings.ServerHandShakeProcessor_0_SERVERS_CURRENT_VERSION_IS_1.toLocalizedString(new Object[] { e.getMessage(), Acceptor.VERSION.toString() }), REPLY_REFUSED);
connection.stats.incFailedConnectionAttempts();
connection.cleanup();
validHandShake = false;
}
if (clientVersion != null) {
if (logger.isDebugEnabled())
logger.debug("Client version: {}", clientVersion);
// Read the appropriate handshake
if (clientVersion.compareTo(Version.GFE_57) >= 0) {
validHandShake = readGFEHandshake(connection, clientVersion);
} else {
connection.refuseHandshake("Unsupported version " + clientVersion + "Server's current version " + Acceptor.VERSION, REPLY_REFUSED);
}
}
return validHandShake;
}
use of org.apache.geode.internal.Version in project geode by apache.
the class Message method serializeAndAddPartNoCopying.
private void serializeAndAddPartNoCopying(Object o) {
Version v = this.version;
if (this.version.equals(Version.CURRENT)) {
v = null;
}
// Create the HDOS with a flag telling it that it can keep any byte[] or ByteBuffers/ByteSources
// passed to it. Do NOT close the HeapDataOutputStream!
HeapDataOutputStream hdos = new HeapDataOutputStream(this.chunkSize, v, true);
try {
BlobHelper.serializeTo(o, hdos);
} catch (IOException ex) {
throw new SerializationException("failed serializing object", ex);
}
this.messageModified = true;
Part part = this.partsList[this.currentPart];
part.setPartState(hdos, true);
this.currentPart++;
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ClientInstantiatorMessage method getMessage.
@Override
protected Message getMessage(CacheClientProxy proxy, byte[] latestValue) throws IOException {
Version clientVersion = proxy.getVersion();
Message message = null;
if (clientVersion.compareTo(Version.GFE_57) >= 0) {
message = getGFEMessage(proxy.getProxyID(), null, clientVersion);
} else {
throw new IOException("Unsupported client version for server-to-client message creation: " + clientVersion);
}
return message;
}
Aggregations