add
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
- List在非多线程场景,默认用ArrayList就够了。只有需要按照插入顺序遍历元素的场景,才考虑使用LinkedList。需考虑线程安全用CopyOnWriteArrayList。或者等。
|
||||
- Set在非多线程场景,默认用HashSet。对排序要求考虑用LinkedHashSet或TreeSet。需考虑线程安全用`cn.hutool.core.collection.ConcurrentHashSet`、ConcurrentSkipListSet、CopyOnWriteArraySet等。
|
||||
- Map在非线程场景,默认使用HashMap就够了。对排序要求考虑用LinkedHashMap或TreeMap。如果存在并发场景,需考虑线程安全用ConcurrentHashMap或ConcurrentSkipListMap等JUC工具包。
|
||||
- Queue的使用规则:要控制内存,用ArrayBlockingQueue。经典生产者消费者,用LinkedBlockingQueue。要窃取任务,用LinkedBlockingDeque。追求极致吞吐且不怕队列暴涨,用ConcurrentLinkedQueue。必须双端且高吞吐,用ConcurrentLinkedDeque。
|
||||
- Lock的使用规则:分布式锁使用Redisson相关API,单机使用ReentrantLock、StampedLock、ReentrantReadWriteLock即可。
|
||||
- Queue的使用原则:要控制内存,用ArrayBlockingQueue。经典生产者消费者,用LinkedBlockingQueue。要窃取任务,用LinkedBlockingDeque。追求极致吞吐且不怕队列暴涨,用ConcurrentLinkedQueue。必须双端且高吞吐,用ConcurrentLinkedDeque。
|
||||
- Lock的使用原则:分布式锁使用Redisson相关API,单机使用ReentrantLock、StampedLock、ReentrantReadWriteLock即可。
|
||||
|
||||
## ORM映射规则
|
||||
|
||||
|
||||
Reference in New Issue
Block a user