1 package test.memoryusage; 2 3 import org.omg.CORBA.*; 4 import org.omg.CORBA.ORBPackage.*; 5 import org.omg.PortableServer.*; 6 7 public class SessionFactoryServant 8 extends SessionFactoryPOA 9 { 10 private ORB orb; 11 private POA poa; 12 13 public SessionFactoryServant( ORB orb, org.omg.PortableServer.POA poa) 14 { 15 this.orb = orb; 16 this.poa = poa; 17 } 18 19 public Session get_Session(String userName, String fullName, 20 String emailAddress, String ip) 21 { 22 synchronized (this) 23 { 24 try 25 { 26 Session session = null; 27 SessionServant servant = new SessionServant(); 28 org.omg.CORBA.Object o = poa.servant_to_reference( servant ); 30 session = SessionHelper.narrow(o); 31 32 34 return session; 35 } 36 catch( Exception e ) 37 { 38 org.jacorb.util.Debug.output(1,e); 39 throw new org.omg.CORBA.UNKNOWN (); 40 } 41 } 42 } 43 44 public synchronized void releaseSession( Session session ) 45 { 46 try 47 { 48 poa.deactivate_object(poa.reference_to_id( session )); 49 } 51 catch(org.omg.PortableServer.POAPackage.WrongAdapter sna) 52 { 53 System.out.println(sna); 54 } 55 catch(org.omg.PortableServer.POAPackage.ObjectNotActive ona) 56 { 57 System.out.println(ona); 58 } 59 catch(org.omg.PortableServer.POAPackage.WrongPolicy wp) 60 { 61 System.out.println(wp); 62 } 63 } 64 } 65 | Popular Tags |