<commit_before># frozen_string_literal: true

module RubyRabbitmqJanus
  class Task < RRJ
    def initialize
      Tools::Log.instance
      Tools::Config.instance
      Tools::Requests.instance
    end

    def start_transaction_handle(exclusive = true, options = {})
      Tools::Log.instance.info "Execute action for intsance : #{options['instance']}"
      session = Tools::Cluster.instance.find_sessions(options['instance'])
      handle = 0
      transaction = Janus::Transactions::Handle.new(exclusive, session, handle)
      transaction.connect do
        yield(transaction)
      end
    end
  end
end<commit_msg>Add comment<commit_after># frozen_string_literal: true

module RubyRabbitmqJanus
  # @author VAILLANT jeremy <<EMAIL>>

  # # RubyRabbitmqJanus - Task
  #
  # This class is used with rake task.
  class Task < RRJ
    def initialize
      Tools::Log.instance
      Tools::Config.instance
      Tools::Requests.instance
    end

    # Create a transaction betwwen apps and janus with a handle
    #
    # @since 2.1.0
    def start_transaction_handle(exclusive = true, options = {})
      Tools::Log.instance.info "Execute action for intsance : #{options['instance']}"
      session = Tools::Cluster.instance.find_sessions(options['instance'])
      handle = 0 # Create always a new handle
      transaction = Janus::Transactions::Handle.new(exclusive, session, handle)
      transaction.connect { yield(transaction) }
    end
  end
end
{'fraction_non_alphanumeric': 0.09821428571428571, 'fraction_numerical': 0.003434065934065934, 'mean_word_length': 3.401812688821752, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3658751', 'n_tokens_mistral': 422, 'n_tokens_neox': 414, 'n_words': 106}