Code example for Semaphore

Methods: acquire

0
     */ 
 
    public void startConnection(ConnectionMessage setup, MessageHandler handler, int downlinkPort) {
	this.characterConnectionKeeper = new CharacterConnectionKeeper();
	 
	Semaphore synchronizer = new Semaphore(0);
	 
	characterConnectionClient = new CharacterConnectionClient(synchronizer, setup, handler, characterConnectionKeeper, downlinkPort);
	characterConnectionClient.start();
	 
	try { 
	    synchronizer.acquire();
	} catch (InterruptedException ex) {
	    System.err.println("Interrupted while waiting for characterconnectionclient to start:\n"+ex);
	} 
    } 
     
    public void startConnection(ConnectionMessage setup, MessageHandlerProvider handlerProvider, String connectionTag, int downlinkPort){
	this.characterConnectionKeeper = new CharacterConnectionKeeper();
	 
Connect your IDE to all the code out there  Get Codota for Java