FileDocCategorySizeDatePackage
ExceptionReuseTest.javaAPI DocExample1189Mon Feb 14 15:09:20 GMT 2000tuning.exception

ExceptionReuseTest

public class ExceptionReuseTest extends Object

Fields Summary
static Exception
REUSED
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        
    
        boolean res;

        REUSED.printStackTrace();;

        int REPEAT = (args.length == 0) ? 500000 : Integer.parseInt(args[0]);
        long time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test1();
        time = System.currentTimeMillis() - time;
        System.out.println("test1() took " + time);

        time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test2();
        time = System.currentTimeMillis() - time;
        System.out.println("test2() took " + time);

        REUSED.printStackTrace();;
    
public static booleantest1()

        try
        {
            throw new Exception();
        }
        catch (Exception e)
        {
            return true;
        }
    
public static booleantest2()

        try
        {
            throw REUSED;
        }
        catch (Exception e)
        {
            return true;
        }