diff --git a/doc/manual/protocols.adoc b/doc/manual/protocols.adoc index 996c4fb52d..612429a846 100644 --- a/doc/manual/protocols.adoc +++ b/doc/manual/protocols.adoc @@ -102,6 +102,8 @@ address chosen will be: | jgroups.use.jdk_logger | If true, the JDK logger (`java.util.logging.Logger`) will be used | jgroups.log_class | The fully qualified name of a class implementing a logger to be used. See <> for details. | jgroups.msg.default_headers | System prop for defining the default number of headers in a Message (default: 4). +| jgroups.version.check | Whether or not to check the version of received messages and discard them if the versions +don't match. Default: true (version check is enabled). |=============== diff --git a/src/org/jgroups/Global.java b/src/org/jgroups/Global.java index 662830bdbd..fa0149d8ac 100644 --- a/src/org/jgroups/Global.java +++ b/src/org/jgroups/Global.java @@ -53,6 +53,8 @@ public final class Global { public static final String USE_JDK_LOGGER="jgroups.use.jdk_logger"; // forces use of the JDK logger public static final String LOG_CLASS="jgroups.log_class"; // class of preferred logger + public static final String VERSION_CHECK="jgroups.version.check"; // used to disable/enable version checking + /** System prop for defining the default number of headers in a Message */ public static final String DEFAULT_HEADERS="jgroups.msg.default_headers"; diff --git a/src/org/jgroups/Version.java b/src/org/jgroups/Version.java index d4e5966b8d..c553a4c1cf 100644 --- a/src/org/jgroups/Version.java +++ b/src/org/jgroups/Version.java @@ -45,7 +45,7 @@ public class Version { public static final String VERSION_PROPERTY = "jgroups.version"; public static final String CODENAME = "jgroups.codename"; private static final Pattern VERSION_REGEXP = Pattern.compile("((\\d+)\\.(\\d+)\\.(\\d+).*)"); - + private static boolean VERSION_CHECK = true; // version checking is enabled by default static { @@ -82,7 +82,9 @@ public class Version { catch(Exception e) { throw new IllegalStateException(String.format("failed parsing %s (%s correct?)", ver, VERSION_FILE), e); } - + String s=Util.getProperty(Global.VERSION_CHECK); + if(s != null) + VERSION_CHECK=Boolean.parseBoolean(s); } public static short getMajor() {return major;} @@ -169,7 +171,7 @@ public static short[] decode(short version) { * @return */ public static boolean isBinaryCompatible(short ver) { - if(version == ver) + if(!VERSION_CHECK || version == ver) return true; short tmp_major=(short)((ver & MAJOR_MASK) >> MAJOR_SHIFT); short tmp_minor=(short)((ver & MINOR_MASK) >> MINOR_SHIFT); @@ -178,7 +180,7 @@ public static boolean isBinaryCompatible(short ver) { public static boolean isBinaryCompatible(short ver1, short ver2) { - if(ver1 == ver2) + if(!VERSION_CHECK || ver1 == ver2) return true; short[] tmp=decode(ver1); short tmp_major=tmp[0], tmp_minor=tmp[1];