private static ConcurrentHashMap initContextServletContext = new ConcurrentHashMap(2);
字段是私有的,但从未在FacesContext类中使用。有存在的理由吗?
在Mojarra特定的com.sun.faces.config.InitFacesContext
实现中通过反射访问,仅在容器初始化期间使用(行号匹配Mojarra 2.2.11):
675 static Map getThreadInitContextMap() {
676 ConcurrentHashMap threadInitContext = null;
677 try {
678 Field threadMap = FacesContext.class.getDeclaredField("threadInitContext");
679 threadMap.setAccessible(true);
680 threadInitContext = (ConcurrentHashMap)threadMap.get(null);
681 } catch (Exception e) {
682 if (LOGGER.isLoggable(Level.FINEST)) {
683 LOGGER.log(Level.FINEST, "Unable to get (thread, init context) map", e);
684 }
685 }
686 return threadInitContext;
687 }
参见:
- 了解FacesContext实例化细节