summaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-08-14 19:35:07 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-08-14 19:35:07 (GMT)
commit039213d919c0bcb8f01805f34b9ff6889b06158f (patch)
treeb5c2158184ccb0c9556a4d1f89931d210d9576ca /java/src
parentb8b219d19d158d272cd6b1037bbc8d6e3d64fc73 (diff)
downloadhdf5-039213d919c0bcb8f01805f34b9ff6889b06158f.zip
hdf5-039213d919c0bcb8f01805f34b9ff6889b06158f.tar.gz
hdf5-039213d919c0bcb8f01805f34b9ff6889b06158f.tar.bz2
Brings file locking changes from develop
Diffstat (limited to 'java/src')
-rw-r--r--java/src/hdf/hdf5lib/H5.java45
-rw-r--r--java/src/jni/h5pFAPLImp.c72
-rw-r--r--java/src/jni/h5pFAPLImp.h27
3 files changed, 144 insertions, 0 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 7681c48..4c9713b 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -6462,6 +6462,51 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close)
throws HDF5LibraryException;
+ /**
+ * H5Pget_use_file_locking retrieves whether we are using file locking.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native boolean H5Pget_use_file_locking(long fapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pget_use_file_locking retrieves whether we ignore file locks when they are disabled.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native boolean H5Pget_ignore_disabled_file_locking(long fapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pset_file_locking sets parameters related to file locking.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ *
+ * @param use_file_locking
+ * IN: Whether the library will use file locking when opening files (mainly for SWMR semantics).
+ *
+ * @param ignore_when_disabled
+ * IN: Whether file locking will be ignored when disabled on a file system (useful for Lustre).
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native void H5Pset_file_locking(long fapl_id, boolean use_file_locking, boolean ignore_when_disabled)
+ throws HDF5LibraryException;
+
// Dataset creation property list (DCPL) routines //
/**
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
index 9ae8775..dbfbb5a 100644
--- a/java/src/jni/h5pFAPLImp.c
+++ b/java/src/jni/h5pFAPLImp.c
@@ -1377,6 +1377,78 @@ done:
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_locking
+ * Signature: (JZZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1locking
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled)
+{
+ hbool_t use_file_locking_val = TRUE;
+ hbool_t ignore_when_disabled_val = TRUE;
+
+ UNUSED(clss);
+
+ use_file_locking_val = (use_file_locking == JNI_TRUE) ? TRUE : FALSE;
+ ignore_when_disabled_val = (ignore_when_disabled == JNI_TRUE) ? TRUE : FALSE;
+
+ if (H5Pset_file_locking((hid_t)fapl_id, use_file_locking_val, ignore_when_disabled_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1locking */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_use_file_locking
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hbool_t use_file_locking_val = TRUE;
+ hbool_t unused = TRUE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_file_locking((hid_t)fapl_id, &use_file_locking_val, &unused) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (use_file_locking_val == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_ignore_disabled_file_locking
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hbool_t ignore_when_disabled_val = TRUE;
+ hbool_t unused = TRUE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_file_locking((hid_t)fapl_id, &unused, &ignore_when_disabled_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (ignore_when_disabled_val == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pset_metadata_read_attempts
* Signature: (JJ)V
*/
diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h
index 9b353e6..b9b4556 100644
--- a/java/src/jni/h5pFAPLImp.h
+++ b/java/src/jni/h5pFAPLImp.h
@@ -392,6 +392,33 @@ Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_locking
+ * Signature: (JZZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1locking
+(JNIEnv *env, jclass clss, jlong fapl_id, jboolean use_file_locking, jboolean ignore_when_disabled);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_use_file_locking
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1use_1file_1locking
+(JNIEnv *env, jclass clss, jlong fapl_id);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_ignore_disabled_file_locking
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1ignore_1disabled_1file_1locking
+(JNIEnv *env, jclass clss, jlong fapl_id);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pset_metadata_read_attempts
* Signature: (JJ)V
*/