lib/openwfe/expressions/fe_concurrence.rb in openwferu-0.9.3 vs lib/openwfe/expressions/fe_concurrence.rb in openwferu-0.9.4

- old
+ new

@@ -55,15 +55,14 @@ attr_accessor \ :sync_expression def apply (workitem) - sync = lookup_attribute(A_SYNC, workitem) - sync = "generic" if not sync + sync = lookup_attribute(:sync, workitem, :generic) @sync_expression = \ - get_expression_map().get_sync_class(sync).new(@attributes) + get_expression_map().get_sync_class(sync).new(self, workitem) @children.each do |child| @sync_expression.add_child(child) end @@ -130,19 +129,19 @@ :count, :reply_count, :cancel_remaining, :unready_queue - def initialize (attributes) + def initialize (synchable, workitem) super() @remaining_children = [] @reply_count = 0 - @count = determine_count(attributes) - @cancel_remaining = determine_remaining(attributes) + @count = determine_count(synchable, workitem) + @cancel_remaining = cancel_remaining?(synchable, workitem) @unready_queue = [] end # @@ -211,11 +210,19 @@ end if @count > 0 and @reply_count >= @count treat_remaining_children(synchable) synchable.reply_to_parent(workitem) + return end + + synchable.store_itself() + + #synchable.ldebug do + # "#{self.class}.do_reply() not replying to parent "+ + # "#{workitem.last_expression_id.to_debug_s}" + #end end def treat_remaining_children (synchable) expool = synchable.get_expression_pool @@ -235,17 +242,20 @@ expool.forget(child) end end end - def determine_remaining (attributes) - a = attributes[A_REMAINING] - return true if not a - return a == REM_CANCEL + def cancel_remaining? (synchable_expression, workitem) + + s = synchable_expression.lookup_attribute( + :remaining, workitem, :cancel) + + return s == :cancel.to_s end - def determine_count (attributes) - s = attributes[A_COUNT] + def determine_count (synchable_expression, workitem) + + s = synchable_expression.lookup_attribute(:count, workitem) return -1 if not s i = s.to_i return -1 if i < 1 return i end