Lines 285-294
Link Here
|
285 |
* of {@link Lookup#getDefault()} to here-in provided lookup. Useful in a |
285 |
* of {@link Lookup#getDefault()} to here-in provided lookup. Useful in a |
286 |
* multi user environment where different users and their requests should |
286 |
* multi user environment where different users and their requests should |
287 |
* be associated with different content of default lookup. |
287 |
* be associated with different content of default lookup. |
|
|
288 |
* <p/> |
289 |
* As a special case, {@code executeWith} will execute the Runnable with |
290 |
* the system global lookup (the one effective during system bootstrap), when |
291 |
* the passed {@code defaultLookup} parameter is {@code null}. This feature may |
292 |
* be useful to switch from a specialized Lookup back to a default one for |
293 |
* some limited processing, or when the caller needs to bypass potential |
294 |
* execution-local content temporary effective in the default Lookup and |
295 |
* work with system-wide services only. |
288 |
* |
296 |
* |
289 |
* @param defaultLookup the lookup to be come default while code is running |
297 |
* @param defaultLookup the lookup to be come default while code is running |
290 |
* @param code the code to execute (synchronously) before the method returns |
298 |
* @param code the code to execute (synchronously) before the method returns |
291 |
* @since 8.30 |
299 |
* @since 8.30 |
|
|
300 |
* @since 8.31 can delegate to the system Lookup |
292 |
*/ |
301 |
*/ |
293 |
public static void executeWith(Lookup defaultLookup, Runnable code) { |
302 |
public static void executeWith(Lookup defaultLookup, Runnable code) { |
294 |
if (!GlobalLookup.execute(defaultLookup, code)) { |
303 |
if (!GlobalLookup.execute(defaultLookup, code)) { |