Skip to content

Commit 9cf97a5

Browse files
authored
Library.java : fix mdb_reader_check api, Env.java : readerCheck impl (#212)
* Library.java : fix mdb_reader_check api, Env.java : readerCheck impl * whitespace in Library.java * upd * update Env.java * remove tabs
1 parent 860c827 commit 9cf97a5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/org/lmdbjava/Env.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.List;
4242

4343
import jnr.ffi.Pointer;
44+
import jnr.ffi.byref.IntByReference;
4445
import jnr.ffi.byref.PointerByReference;
4546
import org.lmdbjava.Library.MDB_envinfo;
4647
import org.lmdbjava.Library.MDB_stat;
@@ -500,6 +501,15 @@ private void validatePath(final File path) {
500501
validateDirectoryEmpty(path);
501502
}
502503

504+
505+
/* Check for stale entries in the reader lock table. */
506+
public int readerCheck() {
507+
final IntByReference resultPtr = new IntByReference();
508+
checkRc(LIB.mdb_reader_check(ptr, resultPtr));
509+
return resultPtr.intValue();
510+
}
511+
512+
503513
/**
504514
* Object has already been closed and the operation is therefore prohibited.
505515
*/
@@ -530,6 +540,7 @@ public AlreadyOpenException() {
530540
}
531541
}
532542

543+
533544
/**
534545
* Builder for configuring and opening Env.
535546
*
@@ -595,6 +606,7 @@ public Env<T> open(final File path, final EnvFlags... flags) {
595606
return open(path, 0664, flags);
596607
}
597608

609+
598610
/**
599611
* Sets the map size.
600612
*

src/main/java/org/lmdbjava/Library.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ int mdb_put(@In Pointer txn, @In Pointer dbi, @In Pointer key,
291291
@In Pointer data,
292292
int flags);
293293

294-
int mdb_reader_check(@In Pointer env, int dead);
294+
int mdb_reader_check(@In Pointer env, @Out IntByReference dead);
295295

296296
int mdb_set_compare(@In Pointer txn, @In Pointer dbi, ComparatorCallback cb);
297297

0 commit comments

Comments
 (0)