From f25a596ae9192d687ffbee5b0be859ce0763fd28 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Thu, 20 Sep 2012 16:02:23 +0000 Subject: [PATCH] Override of sync. method needs to be sync. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1388090 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/lang3/concurrent/TimedSemaphoreTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java index 1f7e28bd4..42529df44 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java @@ -405,7 +405,7 @@ public int getPeriodEnds() { * Invokes the latch if one is set. */ @Override - public void acquire() throws InterruptedException { + public synchronized void acquire() throws InterruptedException { super.acquire(); if (latch != null) { latch.countDown(); @@ -416,11 +416,9 @@ public void acquire() throws InterruptedException { * Counts the number of invocations. */ @Override - protected void endOfPeriod() { + protected synchronized void endOfPeriod() { super.endOfPeriod(); - synchronized (this) { - periodEnds++; - } + periodEnds++; } /**