1 7 8 package com.sun.corba.se.impl.protocol; 9 10 import org.omg.CORBA.SystemException ; 11 import org.omg.CORBA.OBJ_ADAPTER ; 12 import org.omg.CORBA.UNKNOWN ; 13 import org.omg.CORBA.CompletionStatus ; 14 15 import org.omg.CORBA.portable.ServantObject ; 16 17 import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; 18 19 import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher; 20 import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory; 21 import com.sun.corba.se.spi.protocol.ForwardException ; 22 23 import com.sun.corba.se.spi.oa.ObjectAdapter; 24 import com.sun.corba.se.spi.oa.OAInvocationInfo ; 25 import com.sun.corba.se.spi.oa.OADestroyed; 26 27 import com.sun.corba.se.spi.orb.ORB; 28 29 import com.sun.corba.se.spi.ior.IOR ; 30 31 import com.sun.corba.se.spi.logging.CORBALogDomains ; 32 33 import com.sun.corba.se.impl.logging.POASystemException ; 34 import com.sun.corba.se.impl.logging.ORBUtilSystemException ; 35 36 public class POALocalCRDImpl extends LocalClientRequestDispatcherBase 37 { 38 private ORBUtilSystemException wrapper ; 39 private POASystemException poaWrapper ; 40 41 public POALocalCRDImpl( ORB orb, int scid, IOR ior) 42 { 43 super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ); 44 wrapper = ORBUtilSystemException.get( orb, 45 CORBALogDomains.RPC_PROTOCOL ) ; 46 poaWrapper = POASystemException.get( orb, 47 CORBALogDomains.RPC_PROTOCOL ) ; 48 } 49 50 private OAInvocationInfo servantEnter( ObjectAdapter oa ) throws OADestroyed 51 { 52 oa.enter() ; 53 54 OAInvocationInfo info = oa.makeInvocationInfo( objectId ) ; 55 orb.pushInvocationInfo( info ) ; 56 57 return info ; 58 } 59 60 private void servantExit( ObjectAdapter oa ) 61 { 62 try { 63 oa.returnServant(); 64 } finally { 65 oa.exit() ; 66 orb.popInvocationInfo() ; 67 } 68 } 69 70 public ServantObject servant_preinvoke(org.omg.CORBA.Object self, 78 String operation, 79 Class expectedType) 80 { 81 ObjectAdapter oa = oaf.find( oaid ) ; 82 OAInvocationInfo info = null ; 83 84 try { 85 info = servantEnter( oa ) ; 86 info.setOperation( operation ) ; 87 } catch ( OADestroyed ex ) { 88 return servant_preinvoke(self, operation, expectedType); 91 } 92 93 try { 94 try { 95 oa.getInvocationServant( info ); 96 if (!checkForCompatibleServant( info, expectedType )) 97 return null ; 98 } catch (Throwable thr) { 99 servantExit( oa ) ; 102 throw thr ; 103 } 104 } catch ( ForwardException ex ) { 105 111 RuntimeException runexc = new RuntimeException ("deal with this."); 112 runexc.initCause( ex ) ; 113 throw runexc ; 114 } catch ( ThreadDeath ex ) { 115 throw wrapper.runtimeexception( ex ) ; 122 } catch ( Throwable t ) { 123 if (t instanceof SystemException ) 124 throw (SystemException )t ; 125 126 throw poaWrapper.localServantLookup( t ) ; 127 } 128 129 if (!checkForCompatibleServant( info, expectedType )) { 130 servantExit( oa ) ; 131 return null ; 132 } 133 134 return info; 135 } 136 137 public void servant_postinvoke(org.omg.CORBA.Object self, 138 ServantObject servantobj) 139 { 140 ObjectAdapter oa = orb.peekInvocationInfo().oa() ; 141 servantExit( oa ) ; 142 } 143 } 144 145 | Popular Tags |