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
This commit is contained in:
Sebastian Bazley 2012-09-20 16:02:23 +00:00
parent 59702fcddc
commit f25a596ae9
1 changed files with 3 additions and 5 deletions

View File

@ -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++;
}
/**