I have a SessionScoped bean ProcessListBean having two methods startProcess and stopProcess like following
public void startProcess(){
timer.schedule(new TimerTask(){
public void run {
//start after 10seconds
}
},10000);
}
public void stopProcess(){
timer.schedule(new TimerTask(){
public void run {
//stop after 10seconds
}
},10000);
}
and ManagedBean class as;
@Component("processListBean")
@Scope("session")
public class ProcessListBean{
Timer timer;
//methods and other resources such as DAO
}
When I have push a start commandButton in JSF view processListBean->startProcess action is performed, after 10 seconds then when I have pushed stop commandButton in jSF view processlistStopProcess is executed. In that case (vise versa stop-start, start-stop), I am having timer already cancelled exception, I have not come across such exception in J2SE, I think something is wrong with session management in Spring Framework or I have missed some point.
I have also moved timer initializion into @PostConstruct but have not solved my problem.