Code example for CyclicBarrier

0
import java.util.concurrent.Semaphore; 
 
public class JDBCSemaphore implements Callable<Connection>{
	static int count=0;
	private static Semaphore semaphore= new Semaphore(3);
	private static CyclicBarrier cyclicBarrier=new CyclicBarrier(2);
	@Override 
	public Connection call() throws Exception {
		semaphore.acquire();
		Connection con=JDBCUtil.getConnection();
		count++;
		System.out.println("waitin");
		cyclicBarrier.await();
		semaphore.release();
		System.out.println("released");
		return con;
	} 
	public void closeConnection(Connection con){
		try { 
			con.close();
		} catch (SQLException e) {