Added JNI function setCacheDirectory
Modified synchronization