Save This Page
Home » openjdk-7 » com.sun.corba.se.impl » protocol » [javadoc | source]
    1   /*
    2    * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Oracle designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Oracle in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22    * or visit www.oracle.com if you need additional information or have any
   23    * questions.
   24    */
   25   
   26   package com.sun.corba.se.impl.protocol;
   27   
   28   import org.omg.CORBA.BAD_OPERATION;
   29   import org.omg.CORBA.INTERNAL;
   30   import org.omg.CORBA.SystemException;
   31   import org.omg.CORBA.CompletionStatus;
   32   
   33   import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher;
   34   import com.sun.corba.se.spi.protocol.ForwardException;
   35   
   36   // XXX This should be in the SPI
   37   import com.sun.corba.se.impl.protocol.LocalClientRequestDispatcherBase;
   38   
   39   import com.sun.corba.se.spi.oa.OAInvocationInfo;
   40   import com.sun.corba.se.spi.oa.ObjectAdapter;
   41   import com.sun.corba.se.spi.oa.OADestroyed;
   42   
   43   import com.sun.corba.se.spi.orb.ORB;
   44   
   45   import com.sun.corba.se.spi.ior.IOR;
   46   
   47   import com.sun.corba.se.spi.logging.CORBALogDomains;
   48   
   49   import com.sun.corba.se.impl.logging.POASystemException;
   50   
   51   public abstract class ServantCacheLocalCRDBase extends LocalClientRequestDispatcherBase
   52   {
   53   
   54       private OAInvocationInfo cachedInfo ;
   55       protected POASystemException wrapper ;
   56   
   57       protected ServantCacheLocalCRDBase( ORB orb, int scid, IOR ior )
   58       {
   59           super( orb, scid, ior ) ;
   60           wrapper = POASystemException.get( orb,
   61               CORBALogDomains.RPC_PROTOCOL ) ;
   62       }
   63   
   64       protected synchronized OAInvocationInfo getCachedInfo()
   65       {
   66           if (!servantIsLocal)
   67               throw wrapper.servantMustBeLocal() ;
   68   
   69           if (cachedInfo == null) {
   70               ObjectAdapter oa = oaf.find( oaid ) ;
   71               cachedInfo = oa.makeInvocationInfo( objectId ) ;
   72   
   73               // InvocationInfo must be pushed before calling getInvocationServant
   74               orb.pushInvocationInfo( cachedInfo ) ;
   75   
   76               try {
   77                   oa.enter( );
   78                   oa.getInvocationServant( cachedInfo ) ;
   79               } catch (ForwardException freq) {
   80                   throw wrapper.illegalForwardRequest( freq ) ;
   81               } catch( OADestroyed oades ) {
   82                   // This is an error since no user of this implementation
   83                   // should ever throw this exception
   84                   throw wrapper.adapterDestroyed( oades ) ;
   85               } finally {
   86                   oa.returnServant( );
   87                   oa.exit( );
   88                   orb.popInvocationInfo() ;
   89               }
   90           }
   91   
   92           return cachedInfo ;
   93       }
   94   }
   95   
   96   // End of File

Save This Page
Home » openjdk-7 » com.sun.corba.se.impl » protocol » [javadoc | source]