狂野故事

文章
3
资源
0
加入时间
4年0月9天

踏坑:不要用字符串常量去加锁

错误的写法: static private final String LOCK = "LOCK"; void testMethod() { synchronized(LOCK) { ... } }正确的写法:static private final Object LOCK = new Object();void testMethod() {synchronize...