Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5057341

TimeUnit needs additional Enums for longer durations

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0
    • core-libs



      Name: jl125535 Date: 06/03/2004


      A DESCRIPTION OF THE REQUEST :
      The largest unit in TimeUnit is seconds. This needs to also include MINUTES and HOURS so that long duration intervals can be used without resorting to wrapping TimeUnit.

      JUSTIFICATION :
      When specifying an interval (checking whether a file changed, timeouts, etc), it is sometimes necessary to use a larger time than SECONDS. Though MINUTES could be done by multiplying *60, it makes use of TimeUnit inconsistent.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      import static java.util.concurrent.TimeUnit.*;

      long timeout = MINUTES.convertTo(5, MILLISECONDS);
      ACTUAL -
      import static java.util.concurrent.TimeUnit.*;

      long timeout = SECONDS.convertTo(5, MILLISECONDS) * 60;

      ---------- BEGIN SOURCE ----------
      no compilable TimeUnit.MINUTES available.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      import static java.util.concurrent.TimeUnit.*;

      long timeout = SECONDS.convertTo(5, MILLISECONDS) * 60;
      (Incident Review ID: 276148)
      ======================================================================

            martin Martin Buchholz
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: