I have a long run job must run in background and after it finished I want to update jsf view component.
I used SimpleAsyncTaskExecutor
to do the work. It works good but when comming to updating ui then I am getting NullPointerException
.
Here is my code
SimpleAsyncTaskExecutor tasks = new SimpleAsyncTaskExecutor();
tasks.submitListenable(new Callable<String>() {
@Override
public String call() throws Exception {
//Do long time taking job in approximately 16 seconds
doTheBigJob();
//then update view component by it's id
FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(myComponentId);
return "";
}
});
Not: When the time is short (like 2 seconds), no NullPointerException
occurs
Thanks in advence.
Aucun commentaire:
Enregistrer un commentaire