class Concurrent::Edge::CompletableFuturePromise

@!visibility private

Public Class Methods

new(default_executor) click to toggle source
Calls superclass method Concurrent::Edge::AbstractPromise.new
# File lib/concurrent/edge/future.rb, line 966
def initialize(default_executor)
  super CompletableFuture.new(self, default_executor)
end

Public Instance Methods

evaluate_to!(*args, block) click to toggle source

@return [Future]

# File lib/concurrent/edge/future.rb, line 999
def evaluate_to!(*args, block)
  evaluate_to(*args, block).wait!
end
fail(reason = StandardError.new) click to toggle source

Set the `Future` to failed due to some error and wake or notify all threads waiting on it.

@param [Object] reason for the failure @raise [Concurrent::MultipleAssignmentError] if the `Future` has already been set or otherwise completed @return [Future]

# File lib/concurrent/edge/future.rb, line 988
def fail(reason = StandardError.new)
  complete_with Future::Failed.new(reason)
end
success(value) click to toggle source

Set the `Future` to a value and wake or notify all threads waiting on it.

@param [Object] value the value to store in the `Future` @raise [Concurrent::MultipleAssignmentError] if the `Future` has already been set or otherwise completed @return [Future]

# File lib/concurrent/edge/future.rb, line 975
def success(value)
  complete_with Future::Success.new(value)
end
try_fail(reason = StandardError.new) click to toggle source
# File lib/concurrent/edge/future.rb, line 992
def try_fail(reason = StandardError.new)
  !!complete_with(Future::Failed.new(reason), false)
end
try_success(value) click to toggle source
# File lib/concurrent/edge/future.rb, line 979
def try_success(value)
  !!complete_with(Future::Success.new(value), false)
end