try ReentrantLock instead of synchronized