docs: @SuppressWarnings("unchecked")
      @Override
      public void onEnd(PortletInvocationEvent event) {
          final PortletRequest portletRequest = event.getPortletRequest();
          final PortletSession portletSession = portletRequest.getPortletSession(false);
          if (portletSession == null) {
              return;
          }
  
          final HttpServletRequest portalRequest =
                  this.portalRequestUtils.getPortletHttpRequest(portletRequest);
          final HttpSession portalSession = portalRequest.getSession();
  
          if (portalSession != null) {
              NonSerializableMapHolder<String, PortletSession> portletSessions;
              synchronized (WebUtils.getSessionMutex(portalSession)) {
                  portletSessions =
                          (NonSerializableMapHolder<String, PortletSession>)
                                  portalSession.getAttribute(PORTLET_SESSIONS_MAP);
                  if (portletSessions == null || !portletSessions.isValid()) {
                      portletSessions =
                              new NonSerializableMapHolder(
                                      new ConcurrentHashMap<String, PortletSession>());
                      portalSession.setAttribute(PORTLET_SESSIONS_MAP, portletSessions);
                  }
              }
  
              final String contextPath = portletRequest.getContextPath();
              portletSessions.put(contextPath, portletSession);
          }
      }