面试题:你使用过concurrent包下的那些类?

1.executor接口,使用executor接口的子接口ExecutorService用来创建线程池
2.Lock接口下的ReentrantLock类,实现同步,比如三个线程循环打印ABCABCABC...
3.atomic包,使用AtomicInteger类的incrementAndGet()方法来实现原子操作,比如a++
4.Callable接口,重写call方法,实现多线程
5.concarrenHashMap,线程安全的HashMap

猜你喜欢

转载自www.cnblogs.com/linliquan/p/11602468.html