You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-cvs@jakarta.apache.org by ce...@apache.org on 2001/08/06 18:45:09 UTC
cvs commit: jakarta-log4j/src/java/org/apache/log4j/test MDCStress.java
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: log4j-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-cvs-help@jakarta.apache.org