169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport java.io.*; 269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalimport javassist.util.HotSwapper; 369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigalpublic class Test { 569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal public static void main(String[] args) throws Exception { 669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal HotSwapper hs = new HotSwapper(8000); 769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal new HelloWorld().print(); 869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal File newfile = new File("logging/HelloWorld.class"); 1069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal byte[] bytes = new byte[(int)newfile.length()]; 1169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal new FileInputStream(newfile).read(bytes); 1269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal System.out.println("** reload a logging version"); 1369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal hs.reload("HelloWorld", bytes); 1569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal new HelloWorld().print(); 1669e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 1769e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal newfile = new File("HelloWorld.class"); 1869e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal bytes = new byte[(int)newfile.length()]; 1969e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal new FileInputStream(newfile).read(bytes); 2069e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal System.out.println("** reload the original version"); 2169e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal 2269e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal hs.reload("HelloWorld", bytes); 2369e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal new HelloWorld().print(); 2469e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal } 2569e17611504376e4d4603925f8528dfc890fd2c6Luis Sigal} 26