/** * As {@link #withAllSessions(Runnable)}, but for use when there is more * than one copy of DWR in the ServletContext. * <p> * For 99% of cases the former method will be much simpler to use. * @param serverContext The specific DWR context in which to execute */ public static void withAllSessions(ServerContext serverContext, Runnable task) { currentServerContext.set(serverContext); try { TaskDispatcher taskDispatcher = TaskDispatcherFactory.get(serverContext); taskDispatcher.dispatchTask(new AllScriptSessionFilter(), task); } finally { currentServerContext.remove(); } }