Code example for LinkedBlockingQueue

Methods: offer

0
 
        private static final LinkedBlockingQueue<Runnable> QUEUE =
                new LinkedBlockingQueue<Runnable>();
 
        public static void enqueue(Runnable r) {
            QUEUE.offer(r);
        } 
 
        public InnerService() { 
            super("Async Receiver Executor"); 
        } 
 
        @Override 
        protected void onHandleIntent(Intent intent) {
            LogUtils.logD("InnerService.onHandleIntent."); 
 
            if (((AppBase) getApplication()).waitInitComplete()) {
                for (Runnable r = QUEUE.poll(); r != null; r = QUEUE.poll()) {
                    r.run();
                } 
            } else {