Class: Concurrent::Promises::ZipFuturesPromise
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: | |
| Instance Chain: | |
| Inherits: | Concurrent::Promises::BlockedPromise | 
| Defined in: | lib/concurrent-ruby/concurrent/promises.rb | 
Constant Summary
InternalStates - Included
  
Class Attribute Summary
Synchronization::Object - Inherited
Class Method Summary
- .new(delayed, blockers_count, default_executor) ⇒ ZipFuturesPromise constructor private
BlockedPromise - Inherited
AbstractPromise - Inherited
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 | Creates methods for reading and writing (as  | 
| .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
- #on_resolvable(resolved_future, index) private
- #process_on_blocker_resolution(future, index) private
BlockedPromise - Inherited
| #blocked_by | for inspection only. | 
| #delayed_because, #on_blocker_resolution, #touch, #clear_and_propagate_touch, #on_resolvable, #process_on_blocker_resolution, #resolvable? | |
AbstractPromise - Inherited
| #default_executor, #delayed_because, | |
| #event | Alias for AbstractPromise#future. | 
| #future, | |
| #inspect | Alias for AbstractPromise#to_s. | 
| #state, #to_s, #touch, #evaluate_to, #resolve_with | |
Synchronization::Object - Inherited
Synchronization::Volatile - Included
Synchronization::AbstractObject - Inherited
Constructor Details
    .new(delayed, blockers_count, default_executor)  ⇒ ZipFuturesPromise  (private)
  
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 2000
def initialize(delayed, blockers_count, default_executor) super(delayed, blockers_count, Future.new(self, default_executor)) @Resolutions = ::Array.new(blockers_count, nil) on_resolvable nil, nil if blockers_count == 0 end
Instance Method Details
#on_resolvable(resolved_future, index) (private)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/promises.rb', line 2013
def on_resolvable(resolved_future, index) all_fulfilled = true values = ::Array.new(@Resolutions.size) reasons = ::Array.new(@Resolutions.size) @Resolutions.each_with_index do |internal_state, i| fulfilled, values[i], reasons[i] = internal_state.result all_fulfilled &&= fulfilled end if all_fulfilled resolve_with FulfilledArray.new(values) else resolve_with PartiallyRejected.new(values, reasons) end end
#process_on_blocker_resolution(future, index) (private)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/promises.rb', line 2007
def process_on_blocker_resolution(future, index) # TODO (pitr-ch 18-Dec-2016): Can we assume that array will never break under parallel access when never re-sized? @Resolutions[index] = future.internal_state # has to be set before countdown in super super future, index end