<commit_before>
public class ThreadLocalTest {

  private static ThreadLocal tl = new ThreadLocal() {
    protected Object initialValue() {
      return " TL initial";
    }
  };

  private static InheritableThreadLocal itl = new InheritableThreadLocal() {
    protected Object initialValue() {
      return "ITL initial";
    }
    protected Object childValue(Object pval) {
      return (String) pval + " inherited from " + Thread.currentThread().getName();
    }
  };

  private static class TestThread extends Thread {
    private boolean spawn;
    public TestThread(boolean spawn, String name) {
      super(name);
      this.spawn = spawn;
      //System.out.println("\tThread " + getName() + " created");
    }
    public void run() {
      for (int k = 0; k < 4; k++) {

	System.out.println(getName()+ " I" +k+ "\t TL: "
	  + ThreadLocalTest.tl.get());
	System.out.println(getName()+ " I" +k+ "\tITL: "
	  + ThreadLocalTest.itl.get());

	if (spawn && (k & 1) == 1) {
	  TestThread t1 = new TestThread(false, getName() + "x");
	  t1.start();
	  TestThread t2 = new TestThread(false, getName() + "y");
	  t2.start();
	}

	tl.set(tl.get() + " changed by " + getName() + " at k == " + k);
	itl.set(((k & 1) == 0) ? null : ("set by " + getName() + " at k == " + k));
      }
    }
  }

  public static void main(String[] args) {
    new TestThread(true, "x").start();
    new TestThread(true, "y").start();
  }
}

// Sort output
/* Expected Output:<commit_msg>Synchronize printing to avoid intermixing output lines.<commit_after>
public class ThreadLocalTest {

  private static ThreadLocal tl = new ThreadLocal() {
    protected Object initialValue() {
      return " TL initial";
    }
  };

  private static InheritableThreadLocal itl = new InheritableThreadLocal() {
    protected Object initialValue() {
      return "ITL initial";
    }
    protected Object childValue(Object pval) {
      return (String) pval + " inherited from " + Thread.currentThread().getName();
    }
  };

  private static class TestThread extends Thread {
    private boolean spawn;
    public TestThread(boolean spawn, String name) {
      super(name);
      this.spawn = spawn;
      //System.out.println("\tThread " + getName() + " created");
    }
    public void run() {
      for (int k = 0; k < 4; k++) {

	synchronized (System.out) {
	  System.out.println(getName()+ " I" +k+ "\t TL: "
	    + ThreadLocalTest.tl.get());
	  System.out.println(getName()+ " I" +k+ "\tITL: "
	    + ThreadLocalTest.itl.get());
	}

	if (spawn && (k & 1) == 1) {
	  TestThread t1 = new TestThread(false, getName() + "x");
	  t1.start();
	  TestThread t2 = new TestThread(false, getName() + "y");
	  t2.start();
	}

	tl.set(tl.get() + " changed by " + getName() + " at k == " + k);
	itl.set(((k & 1) == 0) ? null : ("set by " + getName() + " at k == " + k));
      }
    }
  }

  public static void main(String[] args) {
    new TestThread(true, "x").start();
    new TestThread(true, "y").start();
  }
}

// Sort output
/* Expected Output:
{'fraction_non_alphanumeric': 0.16611295681063123, 'fraction_numerical': 0.006644518272425249, 'mean_word_length': 2.8652118100128368, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3730374', 'n_tokens_mistral': 1033, 'n_tokens_neox': 992, 'n_words': 267}