Skip to content
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

Use Files.setPosixFilePermissions for chmod when possible #22

Merged

Conversation

slaunay
Copy link
Contributor

@slaunay slaunay commented Dec 22, 2015

I am using lmdbjni for joining data inside MapReduce jobs where the maps are generally short lived.
Those processes can be configured with both -Xms and -Xmx to ensure enough memory is available but loading the library slows down the process at startup as it needs to fork the whole process in order to execute chmod in GNU/Linux.

The following code change uses Java 7 facilities for setting permissions and is backward compatible with Java 5/6 thanks to reflection:

  • use Files.setPosixFilePermissions to avoid forking the JVM for executing chmod 755 when possible (Java 7+)
  • fallback to regular Runtime#exec()

- use Java 7 Files.setPosixFilePermissions to avoid forking the JVM for
  executing chmod 755 when possible
- fallback to regular Runtime#exec()
@slaunay slaunay force-pushed the use-java7-chmod-with-unix-chmod-fallback branch from b755602 to 61ac652 Compare December 22, 2015 12:48
@chirino chirino merged commit 40f9f23 into fusesource:master Jun 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants