Skip to content
Snippets Groups Projects
Commit fc295c3f authored by srosse's avatar srosse
Browse files

OO-2073: loop with a copy of the list of user sessions to prevent concurrent modification exception

parent 4a8169de
No related branches found
No related tags found
No related merge requests found
...@@ -574,16 +574,17 @@ public class UserSessionManager implements GenericEventListener { ...@@ -574,16 +574,17 @@ public class UserSessionManager implements GenericEventListener {
* @param sessionTimeoutInSec * @param sessionTimeoutInSec
*/ */
public void setGlobalSessionTimeout(int sessionTimeoutInSec) { public void setGlobalSessionTimeout(int sessionTimeoutInSec) {
authUserSessions.forEach(session -> { UserSession[] currentSessions = authUserSessions.toArray(new UserSession[0]);
for(int i=currentSessions.length; i-->0; ) {
try{ try{
SessionInfo sessionInfo = session.getSessionInfo(); SessionInfo sessionInfo = currentSessions[i].getSessionInfo();
if(sessionInfo != null && sessionInfo.getSession() != null) { if(sessionInfo != null && sessionInfo.getSession() != null) {
sessionInfo.getSession().setMaxInactiveInterval(sessionTimeoutInSec); sessionInfo.getSession().setMaxInactiveInterval(sessionTimeoutInSec);
} }
} catch(Throwable th){ } catch(Throwable th){
log.error("error setting sesssionTimeout", th); log.error("error setting sesssionTimeout", th);
} }
}); }
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment