Updated Branches:
  refs/heads/wicket-1.5.x 01983f758 -> 6d4787aa7

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/6d4787aa
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6d4787aa
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6d4787aa

Branch: refs/heads/wicket-1.5.x
Commit: 6d4787aa78770d573a4b5feaa59379c8120402a0
Parents: 01983f7
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Wed Oct 17 17:35:53 2012 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Wed Oct 17 17:36:33 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/6d4787aa/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 92c078b..8f37dad 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
@@ -288,10 +288,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;

Reply via email to