Skip to content

Commit

Permalink
fixing thread barrier
Browse files Browse the repository at this point in the history
  • Loading branch information
suhothayan committed Jul 4, 2016
1 parent 0f3512a commit ddc70de
Showing 1 changed file with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,25 @@

package org.wso2.siddhi.core.util;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class ThreadBarrier {

private volatile Lock lock = null;
private ReentrantLock lock = new ReentrantLock();

public void pass() {
if (lock != null) {
synchronized (this) {
if (lock != null) {
lock.lock();
lock.unlock();
}
}
if (lock.isLocked()) {
lock.lock();
lock.unlock();
}
}

public synchronized void lock() {
if (lock == null) {
lock = new ReentrantLock();
}
public void lock() {
lock.lock();

}

public synchronized void unlock() {
if (lock != null) {
try {
} finally {
lock.unlock();
}
lock = null;
}
public void unlock() {
lock.unlock();
}

}

0 comments on commit ddc70de

Please sign in to comment.