Thread.setContextClassLoader creates a new RuntimePermission every time it is called. This method gets called on every RMI call. The permission should only be created once, and kept in a static.
Comments
EVALUATION
This is a straightforward performance tweak.
joshua.bloch@Eng 1998-06-25
There was an assumption of value here that wasn't born out by the data: the savings is less than 1% of the overall cost of invoking the mutator. For typical applications the actual benefit would be negligible.
11-06-2004
PUBLIC COMMENTS
Thread.setContextClassLoader creates a new RuntimePermission every time it is called. This method gets called on every RMI call. The permission should only be created once, and kept in a static.