-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Configurable COLLISION_BUFFER_POWER #4707
Conversation
.../test/java/org/glassfish/jersey/server/internal/monitoring/TimeWindowStatisticsImplTest.java
Show resolved
Hide resolved
2ec9593
to
4d2eb3f
Compare
...r/src/main/java/org/glassfish/jersey/server/internal/monitoring/core/ReservoirConstants.java
Outdated
Show resolved
Hide resolved
ec9b6c8
to
c43095b
Compare
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
}; | ||
int collisionBuffePower = DEFAULT_COLLISION_BUFFER_POWER; | ||
try { | ||
collisionBuffePower = action.run(); |
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.
actually I'm not sure this will work in favor of AccessController.doPrivileged(action);
because purpose of the AccessController is to provide to privileged action those privileges which previously that action did not have. So, AccessControler shall supply those
// Needed by TimeWindowStatisticsImplTest
permission java.util.PropertyPermission "jersey.config.server.monitoring.collision.buffer.power", "read,write";
you are providing for test purposes to the privileged action of getting property. While securityManager is on for sure.
And running action just by run()
method will just invoke it as usual method without any additional privileges.
And SecurityException might not be caught when using AccessController because in that case user can supply proper privileges to be provided to action and thus SecurityException won't be thrown. On the other hand when you just run the action and exception occurs there is no way for privileges to be supplied to it so it will always fail and application will always use default collision buffer.
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.
see note in the source code
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
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
Relates to #4152
Running test with 100000 requests and keeping default value (8):
Running test with 100000 requests and COLLISION_BUFFER_POWER = 3: