Code example for CyclicBarrier

0
	private int nCpu;
	 
	public CyclicBarrierDemo(){ 
		this.nCpu = Runtime.getRuntime().availableProcessors();
		barrier = new CyclicBarrier(nCpu , 
				new Runnable() {
					public void run() { 
						System.out.println("end");
					} 
				}); 
	} 
	 
	public void testBarrier(){ 
		ExecutorService service = Executors.newFixedThreadPool(nCpu);
		 
		for (int i = 0; i < nCpu; i++) {
			service.execute(new Runnable() {
				 
				public void run() { 
					System.out.println("barrier start");
					try {