[jboss-user] [JBoss Seam] - Method call 1000 times slow in object using @In than new

zaya do-not-reply at jboss.com
Sun Jan 6 00:13:09 EST 2008


A test case:

 
  | @Name("test")
  | @Scope(ScopeType.CONVERSATION)
  | @AutoCreate
  | public class Test {
  | 	
  | 	TestMethod testMethodNew = new TestMethod();
  | 	
  | 	@In("testMethod")
  | 	TestMethod testMethodIn;
  | 	
  | 	public void test(){
  | 		System.out.println("start,In:" + System.currentTimeMillis());
  | 			for(int i=0; i<1000; i++) {
  | 				testMethodIn.dummy();
  | 			}
  | 		System.out.println("end  ,In:" + System.currentTimeMillis());
  | 		
  | 		System.out.println("start,New:" + System.currentTimeMillis());
  | 			for(int i=0; i<1000; i++) {
  | 				testMethodNew.dummy();
  | 			}
  | 		System.out.println("end  ,New:" + System.currentTimeMillis());
  | 	}
  | 	
  | }
  | 
  | 
  | @Name("testMethod")
  | @Scope(ScopeType.CONVERSATION)
  | @AutoCreate
  | public class TestMethod {
  | 	public void dummy() {};
  | }
  | 

The output is like:

  | 12:33:08,414 INFO  [STDOUT] start,In:1199593988414
  | 12:33:10,198 INFO  [STDOUT] end  ,In:1199593990198
  | 12:33:10,198 INFO  [STDOUT] start,New:1199593990198
  | 12:33:10,199 INFO  [STDOUT] end  ,New:1199593990199
  | 

Could anyone explain this?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117354#4117354

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117354



More information about the jboss-user mailing list