Search in sources :

Example 16 with Servant

use of org.omg.PortableServer.Servant in project Payara by payara.

the class POARemoteReferenceFactory method preinvoke.

/**
 * This is the implementation of ServantLocator.preinvoke()
 * It is called from the POA before every remote invocation.
 * Return a POA Servant (which is the RMI/IIOP Tie for EJBObject/EJBHome).
 * @param ejbKey
 * @param cookieHolder
 */
@Override
public Servant preinvoke(byte[] ejbKey, POA adapter, String operation, CookieHolder cookieHolder) throws org.omg.PortableServer.ForwardRequest {
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "In preinvoke for operation:{0}", operation);
    }
    // get instance key
    int keyLen = Utility.bytesToInt(ejbKey, INSTANCEKEYLEN_OFFSET);
    byte[] instanceKey = new byte[keyLen];
    System.arraycopy(ejbKey, INSTANCEKEY_OFFSET, instanceKey, 0, keyLen);
    Servant servant = null;
    try {
        while (servant == null) {
            // get the EJBObject / EJBHome
            Remote targetObj = container.getTargetObject(instanceKey, (isRemoteHomeView ? null : remoteBusinessIntf));
            // the looping logic the same as it has always been.
            if (targetObj != null) {
                // get the Tie which is the POA Servant
                // fix for bug 6484935
                @SuppressWarnings("unchecked") Tie tie = (Tie) AccessController.doPrivileged(new PrivilegedAction() {

                    @Override
                    public Tie run() {
                        return presentationMgr.getTie();
                    }
                });
                tie.setTarget(targetObj);
                servant = (Servant) tie;
            }
        }
    } catch (NoSuchObjectLocalException e) {
        logger.log(Level.SEVERE, "iiop.gettie_exception", e);
        throw new OBJECT_NOT_EXIST(GET_TIE_EXCEPTION_CODE, CompletionStatus.COMPLETED_NO);
    } catch (RuntimeException e) {
        logger.log(Level.SEVERE, "iiop.runtime_exception", e);
        throw e;
    }
    return servant;
}
Also used : NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException) Tie(javax.rmi.CORBA.Tie) OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) PrivilegedAction(java.security.PrivilegedAction) Remote(java.rmi.Remote) Servant(org.omg.PortableServer.Servant)

Aggregations

Servant (org.omg.PortableServer.Servant)16 POA (org.omg.PortableServer.POA)5 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)4 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)2 AcsJException (alma.acs.exceptions.AcsJException)2 AcsJCDBRecordDoesNotExistEx (alma.cdbErrType.wrappers.AcsJCDBRecordDoesNotExistEx)2 DummyComponent (alma.jconttest.DummyComponent)2 DummyComponentPOATie (alma.jconttest.DummyComponentPOATie)2 ObjectNotFoundException (org.cristalise.kernel.common.ObjectNotFoundException)2 OffShoot (alma.ACS.OffShoot)1 PropertyOperations (alma.ACS.PropertyOperations)1 AcsJJavaComponentHelperEx (alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)1 BACIPropertyType (alma.TMCDB.baci.BACIPropertyType)1 EmptyStringHandlerBACIPropertyType (alma.TMCDB.baci.EmptyStringHandlerBACIPropertyType)1 AcsComponentClassLoader (alma.acs.classloading.AcsComponentClassLoader)1 ComponentLifecycle (alma.acs.component.ComponentLifecycle)1 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 ComponentInvocationHandler (alma.acs.component.dynwrapper.ComponentInvocationHandler)1 ComponentServantManager (alma.acs.container.ComponentServantManager)1 ClientLogManager (alma.acs.logging.ClientLogManager)1