class Concurrent::Promises::ZipFuturesPromise

def initialize(delayed, blockers_count, default_executor)

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

def on_resolvable(resolved_future, index)

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

def process_on_blocker_resolution(future, index)

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