/**
- * Set the session identifier for this session.
+ * Set the session identifier for this session and notifies any associated
+ * listeners that a new session has been created.
*
* @param id The new session identifier
*/
/**
+ * Set the session identifier for this session and optionally notifies any
+ * associated listeners that a new session has been created.
+ *
+ * @param id The new session identifier
+ * @param notify Should any associated listeners be notified that a new
+ * session has been created?
+ */
+ public void setId(String id, boolean notify);
+
+
+ /**
* Return descriptive information about this Session implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
// use container maxInactiveInterval so that session will expire correctly in case of primary transfer
session.setMaxInactiveInterval(getMaxInactiveInterval());
session.access();
- if(notifySessionListenersOnReplication) {
- session.setId(msg.getSessionID());
- } else {
- session.setIdInternal(msg.getSessionID());
- add(session);
- }
+ session.setId(msg.getSessionID(), notifySessionListenersOnReplication);
session.resetDeltaRequest();
session.endAccess();
if (session != null) {
String newSessionID = deserializeSessionId(msg.getSession());
session.setPrimarySession(false);
- if (notifySessionListenersOnReplication) {
- session.setId(newSessionID);
- } else {
- session.setIdInternal(newSessionID);
- add(session);
- }
+ session.setId(newSessionID, notifyListenersOnReplication);
}
}
this.isPrimarySession = primarySession;
}
+
/**
- * Set the session identifier for this session without notify listeners.
- *
- * @param id
- * The new session identifier
+ * {@inheritDoc}
*/
- public void setIdInternal(String id) {
- this.id = id;
+ @Override
+ public void setId(String id, boolean notify) {
+ super.setId(id, notify);
resetDeltaRequest();
}
+
/**
* Set the session identifier for this session.
*
protected void changeSessionID(Request request, String sessionId,
String newSessionID, Session catalinaSession) {
fireLifecycleEvent("Before session migration", catalinaSession);
- // FIXME: setId trigger session Listener, but only chance to register manager with correct id!
- catalinaSession.setId(newSessionID);
+ catalinaSession.setId(newSessionID, false);
// FIXME: Why we remove change data from other running request?
// setId also trigger resetDeltaRequest!!
if (catalinaSession instanceof DeltaSession)
}
@Override
+ public void setId(String id, boolean notify) {
+ this.sessionId = id;
+ // Ignore notify
+ }
+
+ @Override
public void setManager(Manager manager) {
// NOOP
}
*/
@Override
public void changeSessionId(Session session) {
- session.setId(generateSessionId());
+ session.setId(generateSessionId(), false);
}
*/
@Override
public void setId(String id) {
+ setId(id, true);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setId(String id, boolean notify) {
if ((this.id != null) && (manager != null))
manager.remove(this);
if (manager != null)
manager.add(this);
- tellNew();
+
+ if (notify) {
+ tellNew();
+ }
}
<bug>51038</bug>: Ensure that asynchronous requests are included in
access logs. (markt)
</fix>
+ <fix>
+ <bug>51042</bug>: Don't trigger session creation listeners when a
+ session ID is changed as part of the authentication process. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">