src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java

Print this page




  32 import org.omg.PortableServer.Servant ;
  33 import org.omg.PortableServer.ServantManager ;
  34 import org.omg.PortableServer.ForwardRequest ;
  35 import org.omg.PortableServer.POAPackage.WrongPolicy ;
  36 import org.omg.PortableServer.POAPackage.ObjectNotActive ;
  37 import org.omg.PortableServer.POAPackage.ServantNotActive ;
  38 import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
  39 import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
  40 import org.omg.PortableServer.POAPackage.NoServant ;
  41 
  42 import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
  43 import com.sun.corba.se.impl.orbutil.ORBUtility ;
  44 import com.sun.corba.se.impl.orbutil.ORBConstants ;
  45 
  46 import com.sun.corba.se.impl.oa.NullServantImpl ;
  47 
  48 import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
  49 
  50 import com.sun.corba.se.spi.oa.OAInvocationInfo ;
  51 import com.sun.corba.se.spi.oa.NullServant ;
  52 import com.sun.corba.se.impl.transport.ManagedLocalsThread;
  53 
  54 /** Implementation of POARequesHandler that provides policy specific
  55  * operations on the POA.
  56  */
  57 public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
  58     protected ServantActivator activator ;
  59 
  60     POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa )
  61     {
  62         // assert policies.retainServants()
  63         super( policies, poa ) ;
  64         activator = null ;
  65 
  66         if (!policies.useServantManager())
  67             throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
  68     }
  69 
  70     /* This handles a rather subtle bug (4939892).  The problem is that
  71      * enter will wait on the entry if it is being etherealized.  When the
  72      * deferred state transition completes, the entry is no longer in the


 286     {
 287         if (activator != null)
 288             throw poa.invocationWrapper().servantManagerAlreadySet() ;
 289 
 290         if (servantManager instanceof ServantActivator)
 291             activator = (ServantActivator)servantManager;
 292         else
 293             throw poa.invocationWrapper().servantManagerBadType() ;
 294     }
 295 
 296     public Servant getDefaultServant() throws NoServant, WrongPolicy
 297     {
 298         throw new WrongPolicy();
 299     }
 300 
 301     public void setDefaultServant( Servant servant ) throws WrongPolicy
 302     {
 303         throw new WrongPolicy();
 304     }
 305 
 306     class Etherealizer extends ManagedLocalsThread {
 307         private POAPolicyMediatorImpl_R_USM mediator ;
 308         private ActiveObjectMap.Key key ;
 309         private AOMEntry entry ;
 310         private Servant servant ;
 311         private boolean debug ;
 312 
 313 
 314         public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
 315             ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
 316             boolean debug )
 317         {
 318             this.mediator = mediator ;
 319             this.key = key ;
 320             this.entry = entry;
 321             this.servant = servant;
 322             this.debug = debug ;
 323         }
 324 
 325         public void run() {
 326             if (debug) {




  32 import org.omg.PortableServer.Servant ;
  33 import org.omg.PortableServer.ServantManager ;
  34 import org.omg.PortableServer.ForwardRequest ;
  35 import org.omg.PortableServer.POAPackage.WrongPolicy ;
  36 import org.omg.PortableServer.POAPackage.ObjectNotActive ;
  37 import org.omg.PortableServer.POAPackage.ServantNotActive ;
  38 import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
  39 import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
  40 import org.omg.PortableServer.POAPackage.NoServant ;
  41 
  42 import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
  43 import com.sun.corba.se.impl.orbutil.ORBUtility ;
  44 import com.sun.corba.se.impl.orbutil.ORBConstants ;
  45 
  46 import com.sun.corba.se.impl.oa.NullServantImpl ;
  47 
  48 import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
  49 
  50 import com.sun.corba.se.spi.oa.OAInvocationInfo ;
  51 import com.sun.corba.se.spi.oa.NullServant ;

  52 
  53 /** Implementation of POARequesHandler that provides policy specific
  54  * operations on the POA.
  55  */
  56 public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
  57     protected ServantActivator activator ;
  58 
  59     POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa )
  60     {
  61         // assert policies.retainServants()
  62         super( policies, poa ) ;
  63         activator = null ;
  64 
  65         if (!policies.useServantManager())
  66             throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
  67     }
  68 
  69     /* This handles a rather subtle bug (4939892).  The problem is that
  70      * enter will wait on the entry if it is being etherealized.  When the
  71      * deferred state transition completes, the entry is no longer in the


 285     {
 286         if (activator != null)
 287             throw poa.invocationWrapper().servantManagerAlreadySet() ;
 288 
 289         if (servantManager instanceof ServantActivator)
 290             activator = (ServantActivator)servantManager;
 291         else
 292             throw poa.invocationWrapper().servantManagerBadType() ;
 293     }
 294 
 295     public Servant getDefaultServant() throws NoServant, WrongPolicy
 296     {
 297         throw new WrongPolicy();
 298     }
 299 
 300     public void setDefaultServant( Servant servant ) throws WrongPolicy
 301     {
 302         throw new WrongPolicy();
 303     }
 304 
 305     class Etherealizer extends sun.misc.ManagedLocalsThread {
 306         private POAPolicyMediatorImpl_R_USM mediator ;
 307         private ActiveObjectMap.Key key ;
 308         private AOMEntry entry ;
 309         private Servant servant ;
 310         private boolean debug ;
 311 
 312 
 313         public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
 314             ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
 315             boolean debug )
 316         {
 317             this.mediator = mediator ;
 318             this.key = key ;
 319             this.entry = entry;
 320             this.servant = servant;
 321             this.debug = debug ;
 322         }
 323 
 324         public void run() {
 325             if (debug) {