我认为,我看不出过去工作的情况。
我的锁定了排他性锁,在设计了新物体时,将安排<条码>、Lock条码>、真实回归和另一条<条码> 。
public class A {
private static Timer timer = new Timer();
private static Lock clean_lock = new ReentrantLock();
private static ConcurrentHashMap<String,B> _b_dict = new ConcurrentHashmap<String,B>();
public A() {
if(clean_lock.tryLock()) {
timer.scheduleAtFixedRate(new TimerTaskThread(), new Date(), 60000);
}
}
//Various NON static methods
// use an iterator at one point so they must be NON static
class TimerTaskThread extends TimerTask {
public void run() {
//delete old stuff in _b_dict
}
}
}
//sample usage
public class Main {
public Main() {
A a = new A();
a.contains(new B());
}
}