I want to force method run for specified time.
public Response run(Request req){
//method runImpl must run during specified interval of time(for example for 10 secs)
Response res = runImpl(req);
return response;
}
What is the best way to do this?Thanks!
runImpl should return a boolean for this code to work. You’ll probably want this in a new Thread (basic tutorials abound) if you don’t want your program stalled until it finishes.
This runs every processor moment, if you want it to run on an interval AS WELL as running for 10 seconds, use: