class Concurrent::Promises::AbstractFlatPromise
def add_delayed_of(future)
def add_delayed_of(future) delayed = future.promise.delayed_because if touched? clear_and_propagate_touch delayed else BlockedPromise.add_delayed @DelayedBecause, delayed clear_and_propagate_touch @DelayedBecause if touched? end end
def initialize(delayed_because, blockers_count, event_or_future)
def initialize(delayed_because, blockers_count, event_or_future) delayed = LockFreeStack.of1(self) super(delayed, blockers_count, event_or_future) # noinspection RubyArgCount @Touched = AtomicBoolean.new false @DelayedBecause = delayed_because || LockFreeStack.new event_or_future.add_callback_clear_delayed_node delayed.peek end
def on_resolvable(resolved_future, index)
def on_resolvable(resolved_future, index) resolve_with resolved_future.internal_state end
def resolvable?(countdown, future, index)
def resolvable?(countdown, future, index) !@Future.internal_state.resolved? && super(countdown, future, index) end
def touch
def touch if @Touched.make_true clear_and_propagate_touch @DelayedBecause end end
def touched?
def touched? @Touched.value end