+ One can use + Lookups.execute(yourLookup, yourRunnable) + to temporarily influence return value from + + Lookup.getDefault(). +
+code
is running) changes value
+ * of {@link Lookup#getDefault()} to here-in provided lookup. Useful in a
+ * multi user environment where different users and their requests should
+ * be associated with different content of default lookup.
+ *
+ * @param defaultLookup the lookup to be come default while code is running
+ * @param code the code to execute (synchronously) before the method returns
+ * @since 8.30
+ */
+ public static void execute(Lookup defaultLookup, Runnable code) {
+ GlobalLookup.execute(defaultLookup, code);
+ }
private static class LookupItem+ RequestProcessor + is now + Lookups.execute aware and makes sure the executed task + uses the same default lookup as at the time of its + initial creation. +
+