daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public CashDesk getCashDesk(long maxWaitMillis) throws StoreServiceException {
  2.         locking.lock();
  3.         try {
  4.             if(semaphore.tryAcquire(maxWaitMillis, TimeUnit.MILLISECONDS)) { //// just Acquire (if no reason to try)
  5.                 return cashDesks.poll();
  6.             }
  7.         } catch (InterruptedException e) {
  8.             throw new StoreServiceException(e);
  9.         } finally {
  10.             locking.unlock();
  11.         }
  12.         throw new StoreServiceException("Maximum waiting time exceeded");
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top