execute a method over a maximum period
Good Afternoon in my time zone.
I am using the JavaMail api , and theres is a method in the Folder class called "search" that sometimes take too long to execute. What i want is to execute this method over a maximum period of time( say for example 15 seconds in maximum) , that way i am sure that this method will not run up more than 15 seconds.
messages = maximumMethod(Folder.search(),15);
Do i have to create a thread just to execute this methos and in the main thead use the wait method ?
Thanks very much