ceki        01/08/06 09:45:09

  Added:       src/java/org/apache/log4j/test MDCStress.java
  Log:
  MDCStress.java is a small test case for MDC.java
  
  Revision  Changes    Path
  1.1                  jakarta-log4j/src/java/org/apache/log4j/test/MDCStress.java
  
  Index: MDCStress.java
  ===================================================================
  
  package org.apache.log4j.test;
  
  import org.apache.log4j.*;
  
  public class MDCStress extends Thread {
  
    static Category root = Category.getRoot();  
  
    public 
    static 
    void main(String args[]) {
      for(int i = 0; i < 2; i++) {
        MDC.put("x", new Integer(i));
        MDCStress ms = new MDCStress(true);
        ms.start();
      }    
  
      try {Thread.currentThread().sleep(1000);}catch(Exception e){}
      System.out.println("==========");
      System.gc();
      System.gc();
      try {Thread.currentThread().sleep(1000);}catch(Exception e){}
      System.gc();
      System.out.println("==========");
      try {Thread.currentThread().sleep(1000);}catch(Exception e){}
      System.gc();
    }
  
    boolean dosub;
  
    MDCStress(boolean dosub) {
      this.dosub = dosub;
    }
  
    public
    void run() {
      System.out.println("x="+MDC.get("x")+ "  y="+MDC.get("y"));
      if(dosub) {
        Object o = MDC.get("x");
        if(o instanceof Integer) {
        Integer io = (Integer) o;       
        MDC.put("y", new Integer(io.intValue()*10));
        MDCStress ms = new MDCStress(false);
        ms.start();     
        }
      }
  
    }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to