Added scripts, and change the spinlock in dictionary to java reentrantLock