Code example for AtomicInteger

0
    private static final int KEEP_ALIVE = 4;
 
    private static final BlockingQueue<Runnable> sWorkQueue = new LinkedBlockingQueue<Runnable>();
 
    private static final ThreadFactory sThreadFactory = new ThreadFactory() {
        private final AtomicInteger mCount = new AtomicInteger(1); 
 
        public Thread newThread(Runnable r) { 
            return new Thread(r, "ImageLoader #" + mCount.getAndIncrement()); 
        } 
    }; 
 
    private static final ThreadPoolExecutor sExecutor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
            KEEP_ALIVE, TimeUnit.SECONDS, sWorkQueue, sThreadFactory);
 
    private static final int MESSAGE_POST_RESULT = 0x1;
    private static final int MESSAGE_POST_PROGRESS = 0x2;
    private static final int MESSAGE_POST_CANCEL = 0x3;
 
    private static final InternalHandler sHandler = new InternalHandler();