EventCoordinationServiceImpl.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:portals-pluto 作者:
public void processEvents(PortletContainer container,
      PortletWindow portletWindow, HttpServletRequest request,
      HttpServletResponse response, List<Event> events) {

   ServletContext containerServletContext = PortalRequestContext.getContext(
         request).getServletContext();
   DriverConfiguration driverConfig = (DriverConfiguration) containerServletContext
         .getAttribute(AttributeKeys.DRIVER_CONFIG);

   // PortalURL portalURL = PortalURLParserImpl.getParser().parse(request);
   PortalURL portalURL = PortalRequestContext.getContext(request)
         .createPortalURL();

   // Map<String, PortletWindowThread> portletWindowThreads = new
   // HashMap<String, PortletWindowThread>();

   // ThreadGroup threadGroup = new ThreadGroup("FireEventThreads");

   for (Event event : events) {
      List<String> portletNames = getAllPortletsRegisteredForEvent(event,
            driverConfig, containerServletContext, portalURL);

      // Deliver events to all portlets in the portal
      // Collection<PortletWindowConfig> portlets =
      // getAllPortlets(driverConfig);

      // Limit event delivery to portlets that are on the current page
      Collection<PortletWindowConfig> portlets = new ArrayList<PortletWindowConfig>();
      for (String pid : portalURL.getPortletIds()) {
         portlets.add(PortletWindowConfig.fromId(pid));
      }

      // iterate all portlets in the portal
      for (PortletWindowConfig config : portlets) {
         PortletWindow window = new PortletWindowImpl(container, config,
               portalURL);
         if (portletNames != null) {
            for (String portlet : portletNames) {
               if (portlet.equals(config.getId())) {
                  /*
                   * PLUTO-569: multi-threaded (event) request processing
                   * isn't thread save with the Pluto Portal Driver handling
                   * of request attributes as they all are stored/managed
                   * within the single underlying HttpServletRequest.
                   * Providing proper thread save parallel request processing
                   * would require extensive enhancements to the Pluto Portal
                   * Driver and as such is out-of-scope for the purpose of
                   * the Portal Driver itself.
                   * 
                   * // the thread now is a new one, with possible //
                   * waiting, // for the old to exit
                   * 
                   * 
                   * PortletWindowThread portletWindowThread =
                   * getPortletWindowThread(portletWindowThreads,
                   * threadGroup, container, config, window, request,
                   * response, containerServletContext);
                   * 
                   * // is this event portletWindowThread.addEvent(event);
                   * 
                   * portletWindowThread.start();
                   * 
                   * } } } } waitForEventExecution(threadGroup); try {
                   * Thread.sleep(WAITING_CYCLE); } catch
                   * (InterruptedException e) { LOG.warn(e.getMessage(),e); }
                   * } waitForEventExecution(threadGroup);
                   */
                  doEvent(container, window, event, request, response);
               }
            }
         }
      }
   }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号