|
@@ -948,81 +948,6 @@ int hdfsRename(hdfsFS fs, const char* oldPath, const char* newPath)
|
|
|
|
|
|
|
|
|
|
|
|
-int hdfsLock(hdfsFS fs, const char* path, int shared)
|
|
|
-{
|
|
|
- // JAVA EQUIVALENT:
|
|
|
- // Path p = new Path(path);
|
|
|
- // fs.lock(p);
|
|
|
-
|
|
|
- //Get the JNIEnv* corresponding to current thread
|
|
|
- JNIEnv* env = getJNIEnv();
|
|
|
-
|
|
|
- //Parameters
|
|
|
- jobject jFS = (jobject)fs;
|
|
|
- jboolean jb_shared = shared;
|
|
|
-
|
|
|
- //Create an object of org.apache.hadoop.fs.Path
|
|
|
- jobject jPath = constructNewObjectOfPath(env, path);
|
|
|
- if (jPath == NULL) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- //Lock the file
|
|
|
- int retval = 0;
|
|
|
- if (invokeMethod(env, NULL, INSTANCE, jFS, HADOOP_FS,
|
|
|
- "lock", "(Lorg/apache/hadoop/fs/Path;Z)V",
|
|
|
- jPath, jb_shared) != 0) {
|
|
|
- fprintf(stderr, "Call to org.apache.fs.FileSystem::lock failed!\n");
|
|
|
- errno = EINTERNAL;
|
|
|
- retval = -1;
|
|
|
- }
|
|
|
-
|
|
|
- //Delete unnecessary local references
|
|
|
- destroyLocalReference(env, jPath);
|
|
|
-
|
|
|
- return retval;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-int hdfsReleaseLock(hdfsFS fs, const char* path)
|
|
|
-{
|
|
|
- // JAVA EQUIVALENT:
|
|
|
- // Path f = new Path(path);
|
|
|
- // fs.release(f);
|
|
|
-
|
|
|
- //Get the JNIEnv* corresponding to current thread
|
|
|
- JNIEnv* env = getJNIEnv();
|
|
|
-
|
|
|
- jobject jFS = (jobject)fs;
|
|
|
-
|
|
|
- //Create an object of java.io.File
|
|
|
- jobject jPath = constructNewObjectOfPath(env, path);
|
|
|
- if (jPath == NULL) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
-
|
|
|
- //Release the lock on the file
|
|
|
- int retval = 0;
|
|
|
- if (invokeMethod(env, NULL, INSTANCE, jFS, HADOOP_FS, "release",
|
|
|
- "(Lorg/apache/hadoop/fs/Path;)V", jPath) != 0) {
|
|
|
- fprintf(stderr, "Call to org.apache.hadoop.fs.FileSystem::"
|
|
|
- "release failed!\n");
|
|
|
- errno = EINTERNAL;
|
|
|
- retval = -1;
|
|
|
- goto done;
|
|
|
- }
|
|
|
-
|
|
|
- done:
|
|
|
-
|
|
|
- //Delete unnecessary local references
|
|
|
- destroyLocalReference(env, jPath);
|
|
|
-
|
|
|
- return retval;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
char* hdfsGetWorkingDirectory(hdfsFS fs, char* buffer, size_t bufferSize)
|
|
|
{
|
|
|
// JAVA EQUIVALENT:
|