On 04/20/2012 04:52 PM, [email protected] wrote:
Looks nice!
Maybe there should be a way to avoid using exceptions to control whether we
load a class from classpath or from OSGi. For the best of my knowledge
throwing exceptions are time consuming due to the creation of the stack
trace.
I searched for an alternative when we started talking about it a few days
ago, but I could not find anything.

I share your opinion here, I used it as a kind of last resort, since
I do not know any other way to do it.

Class.forName throws an exception if a class is not on the class path,
but we only need to test if a class is there or not. When we use Class.forName
we can only watch for the exception.

Maybe the code looks a bit nicer when we make a util method which checks for us if a class is there or not. And we can avoid executing the static initializer with the flag
which can be passed to forName.

Jörn

Reply via email to