1 25 26 package org.objectweb.jonas.stests.appli; 27 28 import java.rmi.RemoteException ; 29 30 import javax.ejb.RemoveException ; 31 32 33 37 public class A_thread extends Thread { 38 OrderEntryClerkHome home; 39 int num; 40 int orders; 41 int lines; 42 int numThread; 43 44 public A_thread(OrderEntryClerkHome home, int numThread, int orders, int lines) { 45 this.home = home; 46 this.numThread = numThread; 47 this.orders = orders; 48 this.lines = lines; 49 } 50 51 52 public void run() { 53 54 OrderEntryClerk oecbean = null; 56 57 try { 58 oecbean = home.create(); 59 } catch (Exception e) { 60 System.out.println("Cannot Create OrderEntryClerk bean:" + e); 61 return; 62 } 63 64 try { 65 66 67 for (int i = 0; i < orders; i++) { 69 oecbean.setCustomer(new Integer (numThread+1)); 70 for (int j = 0; j < lines; j++) { 71 oecbean.addOrderLine(new Integer (j+1),j+2); 72 } 73 String numorder = oecbean.placeOrder(); 74 } 75 oecbean.remove(); 77 } catch (RemoteException e) { 78 System.out.println("Thread " + numThread + " : " + e); 79 80 } catch (RemoveException e) { 81 System.out.println("Thread " + numThread + " Cannot remove session: " + e); 82 83 } 84 } 85 } 86 | Popular Tags |