File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
objectbox-java/src/main/java/io/objectbox Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -276,16 +276,19 @@ static boolean isFileOpen(final String canonicalPath) {
276276 synchronized (openFiles ) {
277277 if (!openFiles .contains (canonicalPath )) return false ;
278278 }
279- if (openFilesCheckerThread == null || !openFilesCheckerThread .isAlive ()) {
279+ Thread checkerThread = BoxStore .openFilesCheckerThread ;
280+ if (checkerThread == null || !checkerThread .isAlive ()) {
280281 // Use a thread to avoid finalizers that block us
281- openFilesCheckerThread = new Thread (() -> {
282+ checkerThread = new Thread (() -> {
282283 isFileOpenSync (canonicalPath , true );
283- openFilesCheckerThread = null ; // Clean ref to itself
284+ BoxStore . openFilesCheckerThread = null ; // Clean ref to itself
284285 });
285- openFilesCheckerThread .setDaemon (true );
286- openFilesCheckerThread .start ();
286+ checkerThread .setDaemon (true );
287+
288+ BoxStore .openFilesCheckerThread = checkerThread ;
289+ checkerThread .start ();
287290 try {
288- openFilesCheckerThread .join (500 );
291+ checkerThread .join (500 );
289292 } catch (InterruptedException e ) {
290293 e .printStackTrace ();
291294 }
You can’t perform that action at this time.
0 commit comments