Runtime check that Netty version is 3.10.6, #25967

* Fail fast if invalid Netty version is used.
* Issue netty/netty#4739 may cause messages to not be delivered.
This commit is contained in:
Patrik Nordwall 2018-12-04 15:37:04 +01:00 committed by Johan Andrén
parent c462ecb60f
commit fe2e5cb5a8

View file

@ -186,6 +186,25 @@ class NettyTransportSettings(config: Config) {
config.getDouble("pool-size-factor"), config.getDouble("pool-size-factor"),
config.getInt("pool-size-max")) config.getInt("pool-size-max"))
// Check Netty version >= 3.10.6
{
val nettyVersion = org.jboss.netty.util.Version.ID
def throwInvalidNettyVersion(): Nothing = {
throw new IllegalArgumentException("akka-remote with the Netty transport requires Netty version 3.10.6 or " +
s"later. Version [$nettyVersion] is on the class path. Issue https://github.com/netty/netty/pull/4739 " +
"may cause messages to not be delivered.")
}
try {
val segments: Array[String] = nettyVersion.split("[.-]")
if (segments.length < 3 || segments(0).toInt != 3 || segments(1).toInt != 10 || segments(2).toInt < 6)
throwInvalidNettyVersion()
} catch {
case _: NumberFormatException
throwInvalidNettyVersion()
}
}
} }
/** /**