try {
_cache = loader.loadClass(implementation).newInstance();
} catch (ClassNotFoundException cnfe) {
String msg = "Cannot find class " + implementation + ".";
LOG.error(msg, cnfe);
throw new CacheAcquireException(msg, cnfe);
} catch (IllegalAccessException iae) {
String msg = "Illegal access with class " + implementation + ".";
LOG.error(msg, iae);
throw new CacheAcquireException(msg, iae);
} catch (InstantiationException ie) {
String msg = "Cannot create instance of " + implementation + ".";
LOG.error(msg, ie);
throw new CacheAcquireException(msg, ie);
}
}
Cache cache = null;
try {
Class < ? > cls = loader.loadClass(getCacheClassName());
Constructor < ? > cst = cls.getConstructor(new Class[] {Object.class});
cache = (Cache) cst.newInstance(new Object[] {_cache});
} catch (ClassNotFoundException cnfe) {
String msg = "Cannot find class " + getCacheClassName() + ".";
LOG.error(msg, cnfe);
throw new CacheAcquireException(msg, cnfe);
} catch (NoSuchMethodException nsme) {
String msg = "NoSuchMethodException";
LOG.error(msg, nsme);
throw new CacheAcquireException(msg, nsme);
} catch (IllegalAccessException iae) {
String msg = "Illegal access with class " + getCacheClassName() + ".";
LOG.error(msg, iae);
throw new CacheAcquireException(msg, iae);
} catch (InstantiationException ie) {
String msg = "Cannot create instance of " + getCacheClassName() + ".";
LOG.error(msg, ie);
throw new CacheAcquireException(msg, ie);
} catch (InvocationTargetException ite) {
String msg = "InvocationTargetException";
LOG.error(msg, ite);
throw new IllegalStateException(ite.getMessage());
}