def change_sequence(flow, &block)
      SEQUENCE_LOCK.synchronize do
        old_seq = sequence
        new_seq = @sequence = sequence.pull(flow)
        (@seq_logger ||= [old_seq]) << new_seq
        if block
          result = block.()
          on_sequence_changed(old_seq, flow, new_seq)
          result
        else
          on_sequence_changed(old_seq, flow, new_seq)
          nil
        end
      end
    end
def change_sequence(flow, &block)
      SEQUENCE_LOCK.synchronize do
        old_seq = sequence
        new_seq = @sequence = sequence.pull(flow)
        (@seq_logger ||= [old_seq]) << new_seq
        if block
          result = block.()
          on_sequence_changed(old_seq, flow, new_seq)
          result
        else
          on_sequence_changed(old_seq, flow, new_seq)
          nil
        end
      end
    end
このメソッドはスレッドセーフです