[wildfly-dev] Handling Unsafe as an optional dependency

Sanne Grinovero sanne at hibernate.org
Tue Jul 28 08:25:56 EDT 2015


Hi all,
while checking dependencies of some Hibernate projects for usage of
sun.misc.Unsafe I've found that Apache Avro uses it, but it's
"optional".

When allowing it to use Unsafe it will be more efficient.  Avro
automatically attempts to use it, and in case of failure hide the
exception and store this information in a static field, to
consistently resort to Reflection API as a fallback.

For this to work at all I guess I should be adding the module
dependency to "sun.jdk".

Shall I add this dependency to benefit from it as long as it's an
option, or just have it forget about Unsafe already?

We could also set the property avro.disable.unsafe=true to avoid the
usage attempt.

Thanks,
Sanne


More information about the wildfly-dev mailing list