Code example for Semaphore

Methods: release

0
 
    @Override 
    public Request<?> take() throws InterruptedException {
        Request<?> item = super.take();
        if (item == mStopRequest) { 
            mStopEvent.release();
            return take();
        } 
        return item; 
    } 
 
    private static class MagicStopRequest extends Request<Object> {
        public MagicStopRequest() { 
            super("", null); 
        } 
 
        @Override 
        public Priority getPriority() { 
            return Priority.LOW; 
        }