// $Id: interceptFinalize.java,v 1.1 1998/10/12 07:17:37 oliva Exp $

/* Copyright 1997,1998 Alexandre Oliva <oliva@dcc.unicamp.br>
 *
 * See the files "COPYING" and "README" for information on usage and
 * redistribution of this file.  */

import java.lang.reflect.Method;
import BR.unicamp.Guarana.Guarana;
import BR.unicamp.Guarana.MetaObject;
import BR.unicamp.Guarana.Operation;
import BR.unicamp.Guarana.Result;

/** Tests whether the finalizer interception mechanism is working.  It
 * should keep running forever, printing one line for each intercepted
 * finalizer.  */
public class interceptFinalize extends MetaObject {
    public Result handle(final Operation op, final Object o) {
	System.out.println(op);
	return null;
    }
    public static void main(String[] argv) {
	final MetaObject mo = new interceptFinalize();
	int i=0;
	while (true) {
	    Guarana.reconfigure(new Object(), null, mo);
	    Guarana.reconfigure(new int[1], null, mo);
	    Guarana.reconfigure(new Object[1], null, mo);
	}
    }
}
