Code example for PriorityBlockingQueue

Methods: isEmpty, take

0
    @Override 
    public void handleMessage(Message msg) {
      TackPriorityIntentService service = mServiceReference.get();
      if (service != null) {
        try { 
            final QueuedIntent qi = service.mQueue.take();
            service.onHandleIntent(qi.intent);
        } catch (InterruptedException e) {
          e.printStackTrace();
        } 
         
        if (service.mQueue.isEmpty()) {
          service.stopSelf();
        } 
      } 
    } 
  } 
 
  /** 
   * Creates an IntentService. Invoked by your subclass's constructor. 
   *