Skip to content

Library.java : fix mdb_reader_check api, Env.java : readerCheck impl #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/org/lmdbjava/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.List;

import jnr.ffi.Pointer;
import jnr.ffi.byref.IntByReference;
import jnr.ffi.byref.PointerByReference;
import org.lmdbjava.Library.MDB_envinfo;
import org.lmdbjava.Library.MDB_stat;
Expand Down Expand Up @@ -500,6 +501,15 @@ private void validatePath(final File path) {
validateDirectoryEmpty(path);
}


/* Check for stale entries in the reader lock table. */
public int readerCheck() {
final IntByReference resultPtr = new IntByReference();
checkRc(LIB.mdb_reader_check(ptr, resultPtr));
return resultPtr.intValue();
}


/**
* Object has already been closed and the operation is therefore prohibited.
*/
Expand Down Expand Up @@ -530,6 +540,7 @@ public AlreadyOpenException() {
}
}


/**
* Builder for configuring and opening Env.
*
Expand Down Expand Up @@ -595,6 +606,7 @@ public Env<T> open(final File path, final EnvFlags... flags) {
return open(path, 0664, flags);
}


/**
* Sets the map size.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/lmdbjava/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ int mdb_put(@In Pointer txn, @In Pointer dbi, @In Pointer key,
@In Pointer data,
int flags);

int mdb_reader_check(@In Pointer env, int dead);
int mdb_reader_check(@In Pointer env, @Out IntByReference dead);

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

Expand Down