code: public void setSessionManager(SessionManager sm)
      {
          if (isStarted())
              throw new IllegalStateException("Started");
  
          SessionManager old= getSessionManager();
  
          if (getHttpContext() != null)
          {
              // recover config and remove listeners from old session manager
              if (old != null && old != sm)
              {
                  if (_sessionListeners != null)
                  {
                      for (Iterator i= LazyList.iterator(_sessionListeners); i.hasNext();)
                      {
                          EventListener listener= (EventListener)i.next();
                          _sessionManager.removeEventListener(listener);
                      }
                  }
              }
  
              // Set listeners and config on new listener.
              if (sm != null && old != sm)
              {
                  if (_sessionListeners != null)
                  {
                      for (Iterator i= LazyList.iterator(_sessionListeners); i.hasNext();)
                      {
                          EventListener listener= (EventListener)i.next();
                          sm.addEventListener(listener);
                      }
                  }
              }
          }
  
          super.setSessionManager(sm);
      }
docs: /* ------------------------------------------------------------