1 22 package org.jboss.ejb3.test.microbench; 23 24 import javax.naming.InitialContext ; 25 26 32 public class Benchmark implements BenchmarkMBean 33 { 34 public long benchLocalStateless21(int iterations) throws Exception 35 { 36 StatelessHomeLocal home = (StatelessHomeLocal) new InitialContext ().lookup("StatelessBean21Local"); 37 StatelessLocal21 local = home.create(); 38 long start = System.currentTimeMillis(); 39 for (int i = 0; i < iterations; i++) 40 { 41 local.test(i); 42 } 43 return System.currentTimeMillis() - start; 44 } 45 46 public long benchLocalStateless30(int iterations) throws Exception 47 { 48 StatelessLocal local = (StatelessLocal) new InitialContext ().lookup("StatelessBean/local"); 49 long start = System.currentTimeMillis(); 50 for (int i = 0; i < iterations; i++) 51 { 52 local.test(i); 53 } 54 return System.currentTimeMillis() - start; 55 } 56 } 57 | Popular Tags |