google / guava

Google core libraries for Java
Apache License 2.0
49.73k stars 10.8k forks source link

Futures.immediateScheduledFuture() #810

Open gissuebot opened 9 years ago

gissuebot commented 9 years ago

Original issue created by cow...@bbs.darktech.org on 2011-12-02 at 07:45 PM


I'd like to request the ability to construct a ScheduledFuture with an immediate value set.

Use-case: initializing ScheduledFuture fields with a default value.

gissuebot commented 9 years ago

Original comment posted by fry@google.com on 2011-12-05 at 06:59 PM


When do you need to construct such a Future?

(If we do do this, we need to think about what getDelay and compareTo will do.)


Status: Triaged Labels: Type-Enhancement

gissuebot commented 9 years ago

Original comment posted by cow...@bbs.darktech.org on 2011-12-06 at 01:17 AM


Here is my use-case:

I have a class with a ScheduledFuture field. When a user clicks a button I do the following:

  1. Cancel the future associated with the field
  2. Schedule a new operation, and store the associated future in the field

As you can see, the first time around the field needs a "null object".

I am expecting getDelay() to return 0 since the future is supposed to represent a completed operation. I am expecting compareTo() to return:

(int) Math.signum(-other.getDelay(TimeUnit.MILLISECONDS))

gissuebot commented 9 years ago

Original comment posted by fry@google.com on 2011-12-10 at 04:24 PM


(No comment entered for this change.)


Labels: Package-Concurrent

gissuebot commented 9 years ago

Original comment posted by fry@google.com on 2012-02-16 at 07:17 PM


(No comment entered for this change.)


Status: Acknowledged

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-05-30 at 07:43 PM


(No comment entered for this change.)


Labels: -Type-Enhancement, Type-Addition

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-06-22 at 06:16 PM


(No comment entered for this change.)


Status: Research