1 22 package org.jboss.test.perf.test; 23 import org.jboss.test.perf.interfaces.*; 24 25 import java.util.*; 26 27 public class Command { 28 29 public static void main(String [] args) throws Exception { 30 31 if(args.length != 4) { 32 System.out.println("Usage: vbj Command {create,remove} <jndi-name> <low-count> <high-count>"); 33 return; 34 } 35 36 String command = args[0]; 37 String jndiName = args[1]; 38 int low = Integer.parseInt(args[2]); 39 int high = Integer.parseInt(args[3]); 40 41 javax.naming.Context context = new javax.naming.InitialContext (); 42 43 Object ref = context.lookup("Session"); 44 SessionHome sessionHome = (SessionHome) ref; 45 49 50 Session session = sessionHome.create(jndiName); 51 52 if(command.equalsIgnoreCase("create")) { 53 session.create(low, high); 54 } 55 else if(command.equalsIgnoreCase("remove")) { 56 session.remove(low, high); 57 } 58 else { 59 System.err.println("Invalid command: " + command); 60 } 61 62 session.remove(); 63 64 } 65 66 } 67 | Popular Tags |