Updated Branches:
  refs/heads/wicket-6.x ba2e5ce07 -> 84baf973d

Fix for starvation issue when running this test under newer JDKs


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

Branch: refs/heads/wicket-6.x
Commit: 84baf973dbd098f253240f89296783b9c29bf886
Parents: ba2e5ce
Author: Martijn Dashorst <[email protected]>
Authored: Mon Dec 9 20:41:44 2013 +0100
Committer: Martijn Dashorst <[email protected]>
Committed: Mon Dec 9 20:42:13 2013 +0100

----------------------------------------------------------------------
 .../apache/wicket/page/PageAccessSynchronizerTest.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/84baf973/wicket-core/src/test/java/org/apache/wicket/page/PageAccessSynchronizerTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/page/PageAccessSynchronizerTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/page/PageAccessSynchronizerTest.java
index b5cb403..8d4f8a8 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/page/PageAccessSynchronizerTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/page/PageAccessSynchronizerTest.java
@@ -338,9 +338,14 @@ public class PageAccessSynchronizerTest extends Assert
        @Test
        public void failToReleaseUnderLoad() throws Exception
        {
+               final Duration duration = Duration.seconds(20); /* seconds */
                final ConcurrentLinkedQueue<Exception> errors = new 
ConcurrentLinkedQueue<Exception>();
-               final long endTime = System.currentTimeMillis() + 
Duration.seconds(20).getMilliseconds();
-               final PageAccessSynchronizer sync = new 
PageAccessSynchronizer(Duration.seconds(10));
+               final long endTime = System.currentTimeMillis() + 
duration.getMilliseconds();
+
+               // set the synchronizer timeout one second longer than the test 
runs to prevent 
+               // starvation to become an issue
+               final PageAccessSynchronizer sync = new 
PageAccessSynchronizer(duration.add(Duration.ONE_SECOND));
+
                final CountDownLatch latch = new CountDownLatch(100);
                for (int count = 0; count < 100; count++)
                {
@@ -383,6 +388,9 @@ public class PageAccessSynchronizerTest extends Assert
                }
                latch.await();
                if (!errors.isEmpty())
+               {
+                       logger.error("Number of lock errors that occurred: {}", 
errors.size());
                        throw errors.remove();
+               }
        }
 }

Reply via email to