Not sure I follow you @s1monw. The semaphore is acquired immediately before search(), i.e.:
semaphore.acquire();
client.search(searchRequest, statsListener);

From there it is release()'d by the listener's callbacks. Which part are you suggesting to put inside a try block?