Skip to content

Commit e956bfe

Browse files
BoxStore: remove logs to debug open file checker thread and finalization
1 parent 69ed84f commit e956bfe

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStore.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,10 @@ static String getCanonicalPath(File directory) {
358358
}
359359
}
360360

361-
void verifyNotAlreadyOpen(String canonicalPath) {
361+
static void verifyNotAlreadyOpen(String canonicalPath) {
362362
synchronized (openFiles) {
363-
boolean fileOpen = isFileOpen(canonicalPath); // for retries
363+
isFileOpen(canonicalPath); // for retries
364364
if (!openFiles.add(canonicalPath)) {
365-
System.out.println("verifyNotAlreadyOpen failed for " + this + " (fileOpen=" + fileOpen + ")");
366365
throw new DbException("Another BoxStore is still open for this directory: " + canonicalPath +
367366
". Hint: for most apps it's recommended to keep a BoxStore for the app's life time.");
368367
}
@@ -378,8 +377,7 @@ static boolean isFileOpen(final String canonicalPath) {
378377
if (checkerThread == null || !checkerThread.isAlive()) {
379378
// Use a thread to avoid finalizers that block us
380379
checkerThread = new Thread(() -> {
381-
boolean fileOpen = isFileOpenSync(canonicalPath, true);
382-
System.out.println("checkerThread retries completed (fileOpen=" + fileOpen + ")");
380+
isFileOpenSync(canonicalPath, true);
383381
BoxStore.openFilesCheckerThread = null; // Clean ref to itself
384382
});
385383
checkerThread.setDaemon(true);
@@ -405,7 +403,6 @@ static boolean isFileOpenSync(String canonicalPath, boolean runFinalization) {
405403
int tries = 0;
406404
while (tries < 5 && openFiles.contains(canonicalPath)) {
407405
tries++;
408-
System.out.println("isFileOpenSync calling System.gc() and System.runFinalization()");
409406
System.gc();
410407
if (runFinalization && tries > 1) System.runFinalization();
411408
System.gc();
@@ -532,7 +529,6 @@ public long getDbSizeOnDisk() {
532529
@SuppressWarnings("deprecation") // finalize()
533530
@Override
534531
protected void finalize() throws Throwable {
535-
System.out.println("finalize() called for " + this + " by " + Thread.currentThread());
536532
close();
537533
super.finalize();
538534
}
@@ -658,7 +654,6 @@ public boolean isReadOnly() {
658654
* are properly finished.
659655
*/
660656
public void close() {
661-
System.out.println("close() called for " + this + " (handle=" + handle + ")");
662657
boolean oldClosedState;
663658
synchronized (this) {
664659
oldClosedState = closed;
@@ -721,7 +716,6 @@ public void close() {
721716
openFiles.notifyAll();
722717
}
723718
}
724-
System.out.println("close() finished for " + this);
725719
}
726720

727721
/** dump thread stacks if pool does not terminate promptly. */

0 commit comments

Comments
 (0)