You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This task could take a long time to resolve its value. One could argue thew task may have it's own timeout mechanism (if the HttpClient supports it), but what if it doesn't? What if the underlying task has no explicit means to issue a timeout? Consider this alternative
Perhaps the builder pattern may be applied to avoid an explosion of methods in DeferredManager (which already contains quite a good number due to type safety concerns). What if there were a type (better name pending) with the following API:
This means PromiseScheduler keeps track of state internally, and when the time is right (no pun intended) it schedules the tasks/runnables/etc using a DeferredManager impl that relies on a ScheduledExecutorService (because this type can schedule tasks with a delay). The timeout feature could be implemented with a CountDownLatch for example.
Take the following example
This task could take a long time to resolve its value. One could argue thew task may have it's own timeout mechanism (if the HttpClient supports it), but what if it doesn't? What if the underlying task has no explicit means to issue a timeout? Consider this alternative
Or even
The advantage being that the amount and the time unit are contained between an immutable pair. This will require a custom
Duration
class.The text was updated successfully, but these errors were encountered: