I have a task to do it in background after an HTTP Post Request, so can I do it like this way in Java7 EE. (They said that Java7 EE can use the JSE concurrencies). so here is my code:
@POST public String contactMe( @FormParam("name") String name, @FormParam("email") String email, @FormParam("website") String website, @FormParam("message") String message) {
System.out.println("you have sent name " + name + " email " + email + " website " + website + " message " + message);
/*methode Timer*/
Timer timer = new Timer();
MyTimerTask myTimerTask=new MyTimerTask();
timer.schedule(myTimerTask,10000);
//I have to do something n back ground that take 10 seconds at least
return "<h1>DONE</h1>";
}
I am confused may be there is a better way to handle these kind of problem in the Enterprise World, because memory managing is different than desktop apps. Thanks in advance.