【发布时间】:2015-09-09 08:56:28
【问题描述】:
private static ConcurrentHashMap initContextServletContext = new ConcurrentHashMap(2);
字段是私有的,但从未在 FacesContext 类中使用。有存在的理由吗?
【问题讨论】:
标签: jsf mojarra facescontext
private static ConcurrentHashMap initContextServletContext = new ConcurrentHashMap(2);
字段是私有的,但从未在 FacesContext 类中使用。有存在的理由吗?
【问题讨论】:
标签: jsf mojarra 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 }
【讨论】: