有關Jdon框架的ServiceLocator

fchqcqu發表於2005-08-22
在ejb包的ServiceLocator和web包的ServiceLocator都有getDAO方法,
在ejb包中採用:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
object = classLoader.loadClass(className).newInstance();
來獲得該DAO
而在web包中採用:
object = Class.forName(className).newInstance();

請問banq:
是不是在ejb容器中是一個多執行緒環境,所以要採用Thread.currentThread().getContextClassLoader();來得到ClassLoader
而在web tier裡面就不必了?
我這樣說得有道理嗎?

相關文章