You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/10/17 17:36:27 UTC

git commit: WICKET-4820 Race condition in ResourceSettings: getResourceWatcher() is not thread safe

Updated Branches:
  refs/heads/master 66bfc8851 -> 68a6f64b4


WICKET-4820 Race condition in ResourceSettings: getResourceWatcher() is not thread safe


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

Branch: refs/heads/master
Commit: 68a6f64b4269f517fd16e1b7412c364d4438c0e6
Parents: 66bfc88
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Oct 17 17:35:53 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Oct 17 17:35:53 2012 +0200

----------------------------------------------------------------------
 .../wicket/settings/def/ResourceSettings.java      |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/68a6f64b/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
index b9789b7..3b9b9b7 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
@@ -285,10 +285,16 @@ public class ResourceSettings implements IResourceSettings
 	{
 		if (resourceWatcher == null && start)
 		{
-			final Duration pollFrequency = getResourcePollFrequency();
-			if (pollFrequency != null)
+			synchronized (this)
 			{
-				resourceWatcher = new ModificationWatcher(pollFrequency);
+				if (resourceWatcher == null)
+				{
+					final Duration pollFrequency = getResourcePollFrequency();
+					if (pollFrequency != null)
+					{
+						resourceWatcher = new ModificationWatcher(pollFrequency);
+					}
+				}
 			}
 		}
 		return resourceWatcher;