Code example for Semaphore

Methods: tryAcquire

0
            runSemaphore.release();
        } 
 
        public String getResult() {
            try { 
                runSemaphore.tryAcquire(5L, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                Log.e(THIS_FILE, "Can't acquire run semaphore... problem...");
            } 
            return result;
        } 
    } 
     
     
 
}