[wildfly-dev] Handling Unsafe as an optional dependency

David M. Lloyd david.lloyd at redhat.com
Tue Jul 28 08:48:38 EDT 2015


On 07/28/2015 07:25 AM, Sanne Grinovero wrote:
> 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?

Go ahead and add the dependency IMO.

-- 
- DML


More information about the wildfly-dev mailing list