Code example for PriorityBlockingQueue

0
    @SuppressWarnings("rawtypes") 
    @Override 
    public void onCreate() { 
        super.onCreate(); 
        @SuppressWarnings("unchecked") 
        final PriorityBlockingQueue<Runnable> queue = new PriorityBlockingQueue<Runnable>(10, new ComparePriority());
        fixedSizePoolExecutor = new ThreadPoolExecutor(getCorePoolSize(),
                getCorePoolSize(), 
                100L, 
                TimeUnit.SECONDS,
                queue);
 
        @SuppressWarnings("unchecked") 
        final PriorityBlockingQueue<Runnable> singleThreadQueue = new PriorityBlockingQueue<Runnable>(10, new ComparePriority());
        singleThreadExecutorService = new ThreadPoolExecutor(1, 1, 100L, TimeUnit.SECONDS, singleThreadQueue);
 
    } 
 
    @Override 
    public int onStartCommand(final Intent intent, final int flags, final int startId) {
        handleIntent(intent);