[infinispan-dev] Util.getInstance

Manik Surtani manik at jboss.org
Mon Sep 7 09:44:57 EDT 2009


On 3 Sep 2009, at 10:38, Mircea Markus wrote:

> There are a bunch of getInstance methods in Util for instantiating
> objects that throw very specific checked exceptions(throws
> IllegalAccessException, InstantiationException).
> I'm thinking to remove this checked exceptions and wrap them in an
> runtime CacheException, to simplify the calling code that catches them
> and wraps them in a CacheException itself. If one would need to be
> informed weather a class couldn't be instantiated, it can catch the
> thrown CacheException.
> Wdyt?

Well, they are specifically different exceptions thrown for very  
different reasons.  But then again, I don't think any of the code that  
uses Util.getInstance() cares about this difference and treats them  
the same anyway: rethrow as a CacheException!

So perhaps it does make sense to have this throw CacheException.   
Better still, wouldn't it specifically be a ConfigurationException?   
Isn't this usually used to instantiate configured plugins?

Cheers
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list