You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2018/02/05 14:42:19 UTC

[1/2] wicket git commit: WICKET-6530: fix possible race-condition for session invalidation

Repository: wicket
Updated Branches:
  refs/heads/master 7a5ba65c1 -> ec7a27e83


WICKET-6530: fix possible race-condition for session invalidation


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e7109db9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e7109db9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e7109db9

Branch: refs/heads/master
Commit: e7109db9d446dc8fcf65eb0d91d840c13afdfc4c
Parents: 080df22
Author: Emond Papegaaij <pa...@apache.org>
Authored: Mon Feb 5 14:10:21 2018 +0100
Committer: Emond Papegaaij <pa...@apache.org>
Committed: Mon Feb 5 14:16:30 2018 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/Session.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e7109db9/wicket-core/src/main/java/org/apache/wicket/Session.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Session.java b/wicket-core/src/main/java/org/apache/wicket/Session.java
index 2c5616b..cb8f4a2 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Session.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Session.java
@@ -113,6 +113,12 @@ public abstract class Session implements IClusterable, IEventSink
 	/** Logging object */
 	private static final Logger log = LoggerFactory.getLogger(Session.class);
 
+	/** records if session has been invalidated by the current request */
+	private static final MetaDataKey<Boolean> SESSION_INVALIDATED = new MetaDataKey<Boolean>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
 	/** Name of session attribute under which this session is stored */
 	public static final String SESSION_ATTRIBUTE_NAME = "session";
 
@@ -191,9 +197,6 @@ public abstract class Session implements IClusterable, IEventSink
 	/** Application level meta data. */
 	private MetaDataEntry<?>[] metaData;
 
-	/** True, if session has been invalidated */
-	private transient volatile boolean sessionInvalidated = false;
-
 	/**
 	 * Temporary instance of the session store. Should be set on each request as it is not supposed
 	 * to go in the session.
@@ -480,7 +483,7 @@ public abstract class Session implements IClusterable, IEventSink
 	 */
 	public void invalidate()
 	{
-		sessionInvalidated = true;
+		RequestCycle.get().setMetaData(SESSION_INVALIDATED, true);
 	}
 
 	/**
@@ -493,7 +496,7 @@ public abstract class Session implements IClusterable, IEventSink
 			sessionStore.invalidate(RequestCycle.get().getRequest());
 			sessionStore = null;
 			id = null;
-			sessionInvalidated = false;
+			RequestCycle.get().setMetaData(SESSION_INVALIDATED, false);
 			clientInfo = null;
 			dirty = false;
 			metaData = null;
@@ -542,7 +545,7 @@ public abstract class Session implements IClusterable, IEventSink
 	 */
 	public final boolean isSessionInvalidated()
 	{
-		return sessionInvalidated;
+		return Boolean.TRUE.equals(RequestCycle.get().getMetaData(SESSION_INVALIDATED));
 	}
 
 	/**
@@ -659,7 +662,7 @@ public abstract class Session implements IClusterable, IEventSink
 	{
 		detachFeedback();
 
-		if (sessionInvalidated)
+		if (isSessionInvalidated())
 		{
 			invalidateNow();
 		}


[2/2] wicket git commit: Merge branch 'WICKET-6530' of https://github.com/papegaaij/wicket

Posted by pa...@apache.org.
Merge branch 'WICKET-6530' of https://github.com/papegaaij/wicket


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ec7a27e8
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ec7a27e8
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ec7a27e8

Branch: refs/heads/master
Commit: ec7a27e832d3428f227330c1cf37205d7e52b608
Parents: 7a5ba65 e7109db
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Mon Feb 5 15:41:49 2018 +0100
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Mon Feb 5 15:41:49 2018 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/Session.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------