I'm currently using an API in which an email test is sent out, and about 25 minutes later it is finished. This time can vary depending on server load (The API calls are outsourced to a different company).
With the feature we're developing, we may be creating about 1,000 test a day, and I was wondering whats an effective way to check on the status of each of those tests with Java? If I were to schedule a task, I assume that would leave a thread waiting for x amount of minutes, which doesn't seem very scalable.
You probably want to use the ScheduledThreadPoolExecutor
class.
A
ThreadPoolExecutor
that can additionally schedule commands to run after a given delay, or to execute periodically.
Flexible features:
TimeUnit
when scheduling.Runnable
interface (which defines a run
method).ThreadFactory
(optional).More details and examples can be found here.