Skip to content

Commit

Permalink
Disable security manager in Nailgun
Browse files Browse the repository at this point in the history
The security manager installed by Nailgun seems to add a noticeable
overhead in IO operations.  facebookarchive#134

As a result, we don't install a security manager. Nailgun only uses it
to trap exit, and in our case we don't need to do that since Bloop
doesn't define any `nailShutdown`.
  • Loading branch information
jvican committed Jul 3, 2018
1 parent 62b6230 commit 10c004d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ public void shutdown(boolean exitVM) {
System.setOut(out);
System.setErr(err);

System.setSecurityManager(originalSecurityManager);
// Security manager is always disabled
//System.setSecurityManager(originalSecurityManager);

if (exitVM) {
System.exit(0);
Expand Down Expand Up @@ -381,10 +382,11 @@ public void run() {
NGSession sessionOnDeck = null;

originalSecurityManager = System.getSecurityManager();
System.setSecurityManager(
new NGSecurityManager(
originalSecurityManager));

// Remove overhead of security manager https://github.com/facebook/nailgun/issues/134
//System.setSecurityManager(
// new NGSecurityManager(
// originalSecurityManager));

synchronized (System.in) {
if (!(System.in instanceof ThreadLocalInputStream)) {
Expand Down

0 comments on commit 10c004d

Please sign in to comment.