cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessio Soldano <asold...@redhat.com>
Subject On classloading and EH-Cache availability checks
Date Wed, 24 Apr 2013 10:24:03 GMT
Hi,
I think I might have noticed an issue (at least in my environment) with
the way EHCache availability checks are performed in ReplayCacheFactory
and TokenStoreFactory. The ClassLoaderUtils#loadClass method is used in
static blocks for checking if a class from EHCache is available; if
that's the case, a EHCache-based factory will later be used when a new
instance is required. Now, the factory instance is actually built using
the defining classloader of the ReplayCacheFactory / TokenStoreFactory
class, despite the EHCache availability check having been performed
using the current Thread context classloader (TCCL) first. If EHCache is
visible in the TCCL that is set when initialising the abstract classes
and not visible in their defining classloader, the newInstance
invocation will fail.
I would suggest performing the EHCache availability check using the
defining classloader only in the static block; additionally, if we
really want to try relying on stuff coming from the TCCL only, we could
perform a new check on it when actually required to build a newInstance
and actually use the TCCL to build the EHCache based factory through
reflection.
Any opinion on this?
Cheers
Alessio

-- 
Alessio Soldano
Web Service Lead, JBoss

Mime
View raw message