JDK-6445163 : TimeoutExecutor
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-06-29
  • Updated: 2015-10-12
  • Resolved: 2015-10-12
Related Reports
Duplicate :  
Description
From Doug Lea's TODO list:

5. TimeoutExecutor (or some better name)
    A custom executor with method something like:
      Future submit(Runnable mainTask, Runnable timeoutTask, long time, TimeUnit)
    This sets mainTask in motion. If it does not complete within time,
    it is cancelled and timeoutTask runs (among several variations).
    This can use custom internal queue that doesn't have all the problems
    encountered in this usage pattern by those inside Timer and
    ScheduledThreadPoolExecutor, JSR203 is very likely to ask us to
    develop these for use in async IO, where they may become heavily used.

Comments
provide equivalent functionality in the Great jsr166 jdk9 integration.
12-10-2015

I claim that new methods in CompletableFuture give users this functionality, more or less: http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/CompletableFuture.html#orTimeout-long-java.util.concurrent.TimeUnit- http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/CompletableFuture.html#completeOnTimeout-T-long-java.util.concurrent.TimeUnit-
12-10-2015