The Consumer<ManagedSession> is only used for callers that are Requests to be able to set the ManagedSession on themselves. This isn't at all clear from this api. Moreover, as the SessionListener.onSessionCreated listeners don't have access to the Request, it cannot matter that the ManagedSession is set on the request before the listener is called.
I suggest that this method is changed to:
public ManagedSession newSession(Request request, String requestedSessionId)
and the caller of it can retain the session however it wants.
The
Consumer<ManagedSession>
is only used for callers that are Requests to be able to set theManagedSession
on themselves. This isn't at all clear from this api. Moreover, as theSessionListener.onSessionCreated
listeners don't have access to theRequest
, it cannot matter that theManagedSession
is set on the request before the listener is called.I suggest that this method is changed to:
public ManagedSession newSession(Request request, String requestedSessionId)
and the caller of it can retain the session however it wants.