<commit_before>package org.basex.core;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.basex.util.Util;

/**
 * Management of executing read/write processes. Multiple readers, single
 * writers (readers/writer lock).
 *
 * @author BaseX Team 2005-11, ISC License
 * @author <NAME>
 */
public final class Lock {
  /** Flag for skipping all locking tests. */
  private static final boolean SKIP = false;
  /** List of waiting processes for writers or reading groups. */
  private final List<Resource> list =
    Collections.synchronizedList(new ArrayList<Resource>());
  /** Context. */
  private Context ctx;

  /** States of locking. */
  private static enum State {
    /** Idle state. */  IDLE,
    /** Read state. */  READ,
    /** Write state. */ WRITE
  }

  /** State of the lock. */
  private State state = State.IDLE;
  /** Number of active readers. */
  private int activeR;

  /**
   * Modifications before executing a command.
   * @param w writing flag
   * @param c database context<commit_msg>[FIX] transaction monitor fix for limited number of parallel readers<commit_after>package org.basex.core;

import java.util.ArrayList;

import org.basex.util.Util;

/**
 * Management of executing read/write processes. Multiple readers, single
 * writers (readers/writer lock).
 *
 * @author BaseX Team 2005-11, ISC License
 * @author <NAME>
 */
public final class Lock {
  /** Flag for skipping all locking tests. */
  private static final boolean SKIP = false;
  /** List of waiting processes for writers or reading groups. */
  private final ArrayList<Resource> list = new ArrayList<Resource>();
  /** Context. */
  private Context ctx;

  /** States of locking. */
  private static enum State {
    /** Idle state. */  IDLE,
    /** Read state. */  READ,
    /** Write state. */ WRITE
  }

  /** State of the lock. */
  private State state = State.IDLE;
  /** Number of active readers. */
  private int activeR;

  /**
   * Modifications before executing a command.
   * @param w writing flag
   * @param c database context
{'fraction_non_alphanumeric': 0.11976911976911978, 'fraction_numerical': 0.005772005772005772, 'mean_word_length': 3.05458089668616, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5986715', 'n_tokens_mistral': 610, 'n_tokens_neox': 580, 'n_words': 220}