123456789_123456789_123456789_123456789_123456789_

Class: Concurrent::Promises::AbstractPromise Abstract Private

Do not use. This class is for internal use only.

Overview

This class is abstract.

Constant Summary

InternalStates - Included

PENDING, RESERVED, RESOLVED

Class Attribute Summary

Class Method Summary

Synchronization::Object - Inherited

.atomic_attribute?, .atomic_attributes,
.attr_atomic

Creates methods for reading and writing to a instance variable with volatile (Java) semantic as .attr_volatile does.

.attr_volatile

Creates methods for reading and writing (as attr_accessor does) to a instance variable with volatile (Java) semantic.

.ensure_safe_initialization_when_final_fields_are_present

For testing purposes, quite slow.

.new

Has to be called by children.

.safe_initialization!, .define_initialize_atomic_fields

Synchronization::AbstractObject - Inherited

Instance Method Summary

Synchronization::Object - Inherited

Synchronization::Volatile - Included

Synchronization::AbstractObject - Inherited

Constructor Details

.new(future) ⇒ AbstractPromise

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1553

def initialize(future)
  super()
  @Future = future
end

Instance Method Details

#default_executor

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1564

def default_executor
  future.default_executor
end

#delayed_because

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1581

def delayed_because
  nil
end

#evaluate_to(*args, block) ⇒ Future (private)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1592

def evaluate_to(*args, block)
  resolve_with Fulfilled.new(block.call(*args))
rescue Exception => error
  resolve_with Rejected.new(error)
  raise error unless error.is_a?(StandardError)
end

#event

Alias for #future.

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1562

alias_method :event, :future

#future Also known as: #event

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1558

def future
  @Future
end

#inspect

Alias for #to_s.

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1579

alias_method :inspect, :to_s

#resolve_with(new_state, raise_on_reassign = true) (private)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1587

def resolve_with(new_state, raise_on_reassign = true)
  @Future.resolve_with(new_state, raise_on_reassign)
end

#state

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1568

def state
  future.state
end

#to_s Also known as: #inspect

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1575

def to_s
  format '%s %s>', super[0..-2], @Future
end

#touch

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1572

def touch
end