-
Notifications
You must be signed in to change notification settings - Fork 134
Reduce overhead of the security manager #149
base: main
Are you sure you want to change the base?
Conversation
Continues the work started in facebookarchive#11 by systematically overriding all the other methods of SecurityManager for a fast path when the base security manager is null. Fixes facebookarchive#134
|
In practice, overriding |
jvican
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@sbalabanov How does this approach look? |
|
|
||
| public void checkRead(String file) { | ||
| if (base != null) { | ||
| super.checkRead(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be base.checkRead() instead of super.checkRead()? I have the same question for the new overloads added in this PR. It looks like @qma asked the same question on the original patch: #11 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On reflection, I suspect that this was done for backwards-compatibility reasons, since overriding and delegating to base would be a behavior change whereas this change is only a performance optimization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super.checkRead will eventually get to base.checkPermission. But it would be potentially more efficient to call base.checkRead directly here. The semantics should be the same for any well behaved SecurityManager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit that delegates directly to the corresponding method.
This patch backports the changes from facebookarchive#149 (commit 3366a9e) on top of Nailgun 0.9.1.
495eff8 to
948c51c
Compare
|
Note that SecurityManager is deprecated since Java 17 and will be removed in future releases:
Currently, NailgunServer produces a warning in stderr: |
Continues the work started in #11 by systematically overriding
all the other methods of SecurityManager for a fast path when
the base security manager is null.
Fixes #134