Exemplo n.º 1
0
 @Override
 public void run() {
   try {
     try {
       while (true) {
         PendingPost pendingPost = queue.poll(1000);
         if (pendingPost == null) {
           synchronized (this) {
             // Check again, this time in synchronized
             pendingPost = queue.poll();
             if (pendingPost == null) {
               executorRunning = false;
               return;
             }
           }
         }
         eventBus.invokeSubscriber(pendingPost);
       }
     } catch (InterruptedException e) {
       Log.w("Event", Thread.currentThread().getName() + " was interruppted", e);
     }
   } finally {
     executorRunning = false;
   }
 }
Exemplo n.º 2
0
 @Override
 public void run() {
   PendingPost pendingPost = queue.poll();
   if (pendingPost == null) {
     throw new IllegalStateException("No pending post available");
   }
   eventBus.invokeSubscriber(pendingPost);
 }
Exemplo n.º 3
0
 public void enqueue(Subscription subscription, Object event) {
   PendingPost pendingPost = PendingPost.obtainPendingPost(subscription, event);
   synchronized (this) {
     queue.enqueue(pendingPost);
     if (!executorRunning) {
       executorRunning = true;
       EventBus.executorService.execute(this);
     }
   }
 }
Exemplo n.º 4
0
 public void enqueue(Subscription subscription, Object event) {
   PendingPost pendingPost = PendingPost.obtainPendingPost(subscription, event);
   queue.enqueue(pendingPost);
   EventBus.executorService.execute(this);
 }