FileDocCategorySizeDatePackage
LocalClientRequestDispatcherBase.javaAPI DocJava SE 5 API3508Fri Aug 26 14:54:30 BST 2005com.sun.corba.se.impl.protocol

LocalClientRequestDispatcherBase

public abstract class LocalClientRequestDispatcherBase extends Object implements com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher

Fields Summary
protected com.sun.corba.se.spi.orb.ORB
orb
int
scid
protected boolean
servantIsLocal
protected com.sun.corba.se.spi.oa.ObjectAdapterFactory
oaf
protected com.sun.corba.se.spi.ior.ObjectAdapterId
oaid
protected byte[]
objectId
protected static ThreadLocal
isNextCallValid
Constructors Summary
protected LocalClientRequestDispatcherBase(com.sun.corba.se.spi.orb.ORB orb, int scid, com.sun.corba.se.spi.ior.IOR ior)


          
    
	this.orb = orb ;

	TaggedProfile prof = ior.getProfile() ;
	servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() && 
	    prof.isLocal();

	ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ;
	this.scid = oktemp.getSubcontractId() ;
	RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry() ;
	oaf = sreg.getObjectAdapterFactory( scid ) ;
	oaid = oktemp.getObjectAdapterId() ;
	ObjectId oid = prof.getObjectId() ;
	objectId = oid.getId() ;
    
Methods Summary
protected booleancheckForCompatibleServant(org.omg.CORBA.portable.ServantObject so, java.lang.Class expectedType)
Check that the servant in info (which must not be null) is an instance of the expectedType. If not, set the thread local flag and return false.

	if (so == null)
	    return false ;

	// Normally, this test will never fail.  However, if the servant
	// and the stub were loaded in different class loaders, this test
	// will fail.
	if (!expectedType.isInstance( so.servant )) {
	    isNextCallValid.set( Boolean.FALSE ) ;

	    // When servant_preinvoke returns null, the stub will
	    // recursively re-invoke itself.  Thus, the next call made from 
	    // the stub is another useLocalInvocation call.
	    return false ;
	}

	return true ;
    
public byte[]getObjectId()

	return objectId ;
    
public booleanis_local(org.omg.CORBA.Object self)

	return false;
    
public booleanuseLocalInvocation(org.omg.CORBA.Object self)

	if (isNextCallValid.get() == Boolean.TRUE)
	    return servantIsLocal ;
	else
	    isNextCallValid.set( Boolean.TRUE ) ;

	return false ;