Search in sources :

Example 1 with ReferenceFactory

use of com.sun.corba.ee.spi.oa.rfm.ReferenceFactory in project Payara by payara.

the class POARemoteReferenceFactory method createReferenceFactory.

private ReferenceFactory createReferenceFactory(String poaId, String repoid) throws Exception {
    try {
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, ".createReferenceFactory->: {0} {1}", new Object[] { poaId, repoid });
        }
        ReferenceFactoryManager rfm = (ReferenceFactoryManager) orb.resolve_initial_references(ORBConstants.REFERENCE_FACTORY_MANAGER);
        List<Policy> policies = new ArrayList<Policy>();
        // Servant caching for local RMI-IIOP invocation performance
        policies.add(ServantCachingPolicy.getPolicy());
        // OTS Policy
        policies.add(new OTSPolicyImpl());
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, ".createReferenceFactory: {0} {1}: {2}", new Object[] { poaId, repoid, ejbDescriptor });
        }
        // CSIv2 Policy
        policies.add(new CSIv2Policy(ejbDescriptor));
        String threadPoolName = container.getUseThreadPoolId();
        int threadPoolNumericID = 0;
        boolean usePassByReference = container.getPassByReference();
        if (usePassByReference) {
            policies.add(new CopyObjectPolicy(PASS_BY_REFERENCE_ID));
        }
        if (threadPoolName != null) {
            ThreadPoolManager threadPoolManager = S1ASThreadPoolManager.getThreadPoolManager();
            try {
                threadPoolNumericID = threadPoolManager.getThreadPoolNumericId(threadPoolName);
                policies.add(new RequestPartitioningPolicy(threadPoolNumericID));
            } catch (Exception ex) {
                logger.log(Level.WARNING, "Not using threadpool-request-partitioning...", ex);
            }
        }
        if (logger.isLoggable(Level.FINE)) {
            String jndiName = ejbDescriptor.getJndiName();
            logger.log(Level.FINE, "Using Thread-Pool: [{0} ==> {1}] for jndi name: {2}", new Object[] { threadPoolName, threadPoolNumericID, jndiName });
            logger.log(Level.FINE, "Pass by reference: [{0}] for jndi name: {1}", new Object[] { usePassByReference, usePassByReference });
        }
        // if EJB allows only SSL invocations
        if (ejbDescriptor.allMechanismsRequireSSL()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.WARNING, ".createReferenceFactory: {0} {1}: adding ZeroPortPolicy", new Object[] { poaId, repoid });
            }
            if (!GlassFishORBManager.disableSSLCheck()) {
                policies.add(ZeroPortPolicy.getPolicy());
            }
        }
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, ".createReferenceFactory: {0} {1}: policies: {2}", new Object[] { poaId, repoid, policies });
        }
        ReferenceFactory rf = rfm.create(poaId, repoid, policies, this);
        return rf;
    } finally {
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.WARNING, ".createReferenceFactory<-: {0} {1}", new Object[] { poaId, repoid });
        }
    }
}
Also used : Policy(org.omg.CORBA.Policy) ServantCachingPolicy(com.sun.corba.ee.spi.extension.ServantCachingPolicy) ZeroPortPolicy(com.sun.corba.ee.spi.extension.ZeroPortPolicy) CopyObjectPolicy(com.sun.corba.ee.spi.extension.CopyObjectPolicy) RequestPartitioningPolicy(com.sun.corba.ee.spi.extension.RequestPartitioningPolicy) CopyObjectPolicy(com.sun.corba.ee.spi.extension.CopyObjectPolicy) ArrayList(java.util.ArrayList) IOException(java.io.IOException) NotSerializableException(java.io.NotSerializableException) NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException) ReferenceFactory(com.sun.corba.ee.spi.oa.rfm.ReferenceFactory) RemoteReferenceFactory(org.glassfish.enterprise.iiop.api.RemoteReferenceFactory) RequestPartitioningPolicy(com.sun.corba.ee.spi.extension.RequestPartitioningPolicy) ReferenceFactoryManager(com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager) ThreadPoolManager(com.sun.corba.ee.spi.threadpool.ThreadPoolManager) S1ASThreadPoolManager(org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager)

Example 2 with ReferenceFactory

use of com.sun.corba.ee.spi.oa.rfm.ReferenceFactory in project Payara by payara.

the class POAProtocolMgr method getRemoteNamingReference.

private org.omg.CORBA.Object getRemoteNamingReference(Remote remoteNamingProvider) {
    final ServantLocator locator = new RemoteNamingServantLocator(orb, remoteNamingProvider);
    final PresentationManager pm = ORB.getPresentationManager();
    String repositoryId;
    try {
        repositoryId = pm.getRepositoryId(remoteNamingProvider);
    } catch (Exception exc) {
        throw new RuntimeException(exc);
    }
    final List<Policy> policies = new ArrayList<Policy>();
    final ReferenceFactory rf = getRFM().create("RemoteSerialContextProvider", repositoryId, policies, locator);
    // arbitrary
    final byte[] oid = { 0, 3, 5, 7, 2, 37, 42 };
    final org.omg.CORBA.Object ref = rf.createReference(oid);
    return ref;
}
Also used : Policy(org.omg.CORBA.Policy) ArrayList(java.util.ArrayList) ServantLocator(org.omg.PortableServer.ServantLocator) TransactionRequiredLocalException(javax.ejb.TransactionRequiredLocalException) TransactionRolledbackLocalException(javax.ejb.TransactionRolledbackLocalException) RemoteException(java.rmi.RemoteException) NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException) PresentationManager(com.sun.corba.ee.spi.presentation.rmi.PresentationManager) ReferenceFactory(com.sun.corba.ee.spi.oa.rfm.ReferenceFactory) RemoteReferenceFactory(org.glassfish.enterprise.iiop.api.RemoteReferenceFactory)

Aggregations

ReferenceFactory (com.sun.corba.ee.spi.oa.rfm.ReferenceFactory)2 ArrayList (java.util.ArrayList)2 NoSuchObjectLocalException (javax.ejb.NoSuchObjectLocalException)2 RemoteReferenceFactory (org.glassfish.enterprise.iiop.api.RemoteReferenceFactory)2 Policy (org.omg.CORBA.Policy)2 CopyObjectPolicy (com.sun.corba.ee.spi.extension.CopyObjectPolicy)1 RequestPartitioningPolicy (com.sun.corba.ee.spi.extension.RequestPartitioningPolicy)1 ServantCachingPolicy (com.sun.corba.ee.spi.extension.ServantCachingPolicy)1 ZeroPortPolicy (com.sun.corba.ee.spi.extension.ZeroPortPolicy)1 ReferenceFactoryManager (com.sun.corba.ee.spi.oa.rfm.ReferenceFactoryManager)1 PresentationManager (com.sun.corba.ee.spi.presentation.rmi.PresentationManager)1 ThreadPoolManager (com.sun.corba.ee.spi.threadpool.ThreadPoolManager)1 IOException (java.io.IOException)1 NotSerializableException (java.io.NotSerializableException)1 RemoteException (java.rmi.RemoteException)1 TransactionRequiredLocalException (javax.ejb.TransactionRequiredLocalException)1 TransactionRolledbackLocalException (javax.ejb.TransactionRolledbackLocalException)1 S1ASThreadPoolManager (org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager)1 ServantLocator (org.omg.PortableServer.ServantLocator)1