FacesContextstored as ThreadLocalin the thread responsible for the HTTP request that called FacesServlet, which is responsible for the creation FacesContext. This thread usually only passes through JSF-controlled bean methods. FacesContextnot available in other threads generated by this thread.
. , , HTTP- HTTP . - HTTP.
-. : ? ? Runnable .
, .
public class Task implements Runnable {
private Work work;
public Task(Work work) {
this.work = work;
}
@Override
public void run() {
}
}
Work work = (Work) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("work");
Task task = new Task(work);
, , , . , , , , . "push". SSE websockets. - : JSF/Java EE. PrimeFaces,
<p:push>. OmniFaces, <o:socket>.
, Runnable - Java EE . Q & A, , :