Search in sources :

Example 1 with CheckpointAtEndOfMethodDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor in project Payara by payara.

the class CheckpointAtEndOfMethodNode method getDescriptor.

@Override
public CheckpointAtEndOfMethodDescriptor getDescriptor() {
    if (descriptor == null) {
        descriptor = new CheckpointAtEndOfMethodDescriptor();
        Object parentDesc = getParentNode().getDescriptor();
        if (parentDesc instanceof EjbDescriptor) {
            descriptor.setEjbDescriptor((EjbDescriptor) parentDesc);
        }
    }
    return descriptor;
}
Also used : EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Example 2 with CheckpointAtEndOfMethodDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor in project Payara by payara.

the class EjbNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param node name for the descriptor
 * @param the descriptor to write
 * @return the DOM tree top node
 */
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbDescriptor ejbDescriptor) {
    Element ejbNode = (Element) super.writeDescriptor(parent, nodeName, ejbDescriptor);
    appendTextChild(ejbNode, RuntimeTagNames.EJB_NAME, ejbDescriptor.getName());
    appendTextChild(ejbNode, RuntimeTagNames.JNDI_NAME, ejbDescriptor.getJndiName());
    RuntimeDescriptorNode.writeCommonComponentInfo(ejbNode, ejbDescriptor);
    appendTextChild(ejbNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPassByReference()));
    if (ejbDescriptor instanceof IASEjbCMPEntityDescriptor) {
        CmpNode cmpNode = new CmpNode();
        cmpNode.writeDescriptor(ejbNode, RuntimeTagNames.CMP, (IASEjbCMPEntityDescriptor) ejbDescriptor);
    }
    // principal
    if (Boolean.FALSE.equals(ejbDescriptor.getUsesCallerIdentity())) {
        RunAsIdentityDescriptor raid = ejbDescriptor.getRunAsIdentity();
        if (raid != null && raid.getPrincipal() != null) {
            Node principalNode = appendChild(ejbNode, RuntimeTagNames.PRINCIPAL);
            appendTextChild(principalNode, RuntimeTagNames.NAME, raid.getPrincipal());
        }
    }
    if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
        EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
        // mdb-connection-factory?
        if (ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory() != null) {
            MDBConnectionFactoryNode mcfNode = new MDBConnectionFactoryNode();
            mcfNode.writeDescriptor(ejbNode, RuntimeTagNames.MDB_CONNECTION_FACTORY, ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory());
        }
        // jms-durable-subscription-name
        if (msgBeanDesc.hasDurableSubscription()) {
            appendTextChild(ejbNode, RuntimeTagNames.DURABLE_SUBSCRIPTION, msgBeanDesc.getDurableSubscriptionName());
        }
        appendTextChild(ejbNode, RuntimeTagNames.JMS_MAX_MESSAGES_LOAD, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getJmsMaxMessagesLoad()));
    }
    // ior-configuration
    IORConfigurationNode iorNode = new IORConfigurationNode();
    for (EjbIORConfigurationDescriptor iorConf : ejbDescriptor.getIORConfigurationDescriptors()) {
        iorNode.writeDescriptor(ejbNode, RuntimeTagNames.IOR_CONFIG, iorConf);
    }
    appendTextChild(ejbNode, RuntimeTagNames.IS_READ_ONLY_BEAN, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean()));
    appendTextChild(ejbNode, RuntimeTagNames.REFRESH_PERIOD_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getRefreshPeriodInSeconds()));
    appendTextChild(ejbNode, RuntimeTagNames.COMMIT_OPTION, ejbDescriptor.getIASEjbExtraDescriptors().getCommitOption());
    appendTextChild(ejbNode, RuntimeTagNames.CMT_TIMEOUT_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getCmtTimeoutInSeconds()));
    appendTextChild(ejbNode, RuntimeTagNames.USE_THREAD_POOL_ID, ejbDescriptor.getIASEjbExtraDescriptors().getUseThreadPoolId());
    // gen-classes
    writeGenClasses(ejbNode, ejbDescriptor);
    // bean-pool
    BeanPoolDescriptor beanPoolDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanPool();
    if (beanPoolDesc != null) {
        BeanPoolNode bpNode = new BeanPoolNode();
        bpNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_POOL, beanPoolDesc);
    }
    // bean-cache
    BeanCacheDescriptor beanCacheDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanCache();
    if (beanCacheDesc != null) {
        BeanCacheNode bcNode = new BeanCacheNode();
        bcNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_CACHE, beanCacheDesc);
    }
    if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
        EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
        if (msgBeanDesc.hasResourceAdapterMid()) {
            MDBResourceAdapterNode mdb = new MDBResourceAdapterNode();
            mdb.writeDescriptor(ejbNode, RuntimeTagNames.MDB_RESOURCE_ADAPTER, msgBeanDesc);
        }
    } else if (ejbDescriptor instanceof EjbSessionDescriptor) {
        // web-services
        WebServiceEndpointRuntimeNode wsRuntime = new WebServiceEndpointRuntimeNode();
        wsRuntime.writeWebServiceEndpointInfo(ejbNode, ejbDescriptor);
    }
    // flush-at-end-of-method
    FlushAtEndOfMethodDescriptor flushMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getFlushAtEndOfMethodDescriptor();
    if (flushMethodDesc != null) {
        FlushAtEndOfMethodNode flushNode = new FlushAtEndOfMethodNode();
        flushNode.writeDescriptor(ejbNode, RuntimeTagNames.FLUSH_AT_END_OF_METHOD, flushMethodDesc);
    }
    // checkpointed-methods
    // checkpoint-at-end-of-method
    CheckpointAtEndOfMethodDescriptor checkpointMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getCheckpointAtEndOfMethodDescriptor();
    if (checkpointMethodDesc != null) {
        CheckpointAtEndOfMethodNode checkpointNode = new CheckpointAtEndOfMethodNode();
        checkpointNode.writeDescriptor(ejbNode, RuntimeTagNames.CHECKPOINT_AT_END_OF_METHOD, checkpointMethodDesc);
    }
    if (ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing() != null) {
        appendTextChild(ejbNode, RuntimeTagNames.PER_REQUEST_LOAD_BALANCING, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing()));
    }
    // availability-enabled
    setAttribute(ejbNode, RuntimeTagNames.AVAILABILITY_ENABLED, ejbDescriptor.getIASEjbExtraDescriptors().getAttributeValue(IASEjbExtraDescriptors.AVAILABILITY_ENABLED));
    return ejbNode;
}
Also used : BeanCacheDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor) WebServiceEndpointRuntimeNode(com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode) RunAsIdentityDescriptor(com.sun.enterprise.deployment.RunAsIdentityDescriptor) XMLElement(com.sun.enterprise.deployment.node.XMLElement) Element(org.w3c.dom.Element) ResourceEnvRefNode(com.sun.enterprise.deployment.node.runtime.ResourceEnvRefNode) WebServiceEndpointRuntimeNode(com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode) EjbRefNode(com.sun.enterprise.deployment.node.runtime.EjbRefNode) ServiceRefNode(com.sun.enterprise.deployment.node.runtime.ServiceRefNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ResourceRefNode(com.sun.enterprise.deployment.node.runtime.ResourceRefNode) Node(org.w3c.dom.Node) RuntimeDescriptorNode(com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode) MessageDestinationRefNode(com.sun.enterprise.deployment.node.runtime.MessageDestinationRefNode) EjbIORConfigurationDescriptor(com.sun.enterprise.deployment.EjbIORConfigurationDescriptor) IASEjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.IASEjbCMPEntityDescriptor) EjbMessageBeanDescriptor(org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor) EjbSessionDescriptor(com.sun.enterprise.deployment.EjbSessionDescriptor) FlushAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.FlushAtEndOfMethodDescriptor) BeanPoolDescriptor(com.sun.enterprise.deployment.runtime.BeanPoolDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Example 3 with CheckpointAtEndOfMethodDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor in project Payara by payara.

the class AsynchronousTask method loadCheckpointInfo.

protected void loadCheckpointInfo() {
    try {
        if (isHAEnabled) {
            Iterator iter = invocationInfoMap.values().iterator();
            while (iter.hasNext()) {
                InvocationInfo info = (InvocationInfo) iter.next();
                info.checkpointEnabled = false;
                MethodDescriptor md = new MethodDescriptor(info.method, info.methodIntf);
                IASEjbExtraDescriptors extraDesc = ejbDescriptor.getIASEjbExtraDescriptors();
                if (extraDesc != null) {
                    CheckpointAtEndOfMethodDescriptor cpDesc = extraDesc.getCheckpointAtEndOfMethodDescriptor();
                    if (cpDesc != null) {
                        info.checkpointEnabled = cpDesc.isCheckpointEnabledFor(md);
                    }
                }
                if (info.checkpointEnabled) {
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.log(Level.FINE, "[SFSBContainer] " + info.method + " MARKED for " + "end-of-method-checkpoint");
                    }
                }
            }
        }
    } catch (Exception ex) {
        _logger.log(Level.WARNING, EXCEPTION_WHILE_LOADING_CHECKPOINT, ex);
    }
}
Also used : InvocationInfo(com.sun.ejb.InvocationInfo) Iterator(java.util.Iterator) IASEjbExtraDescriptors(org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor) IllegalLoopbackException(javax.ejb.IllegalLoopbackException) ConcurrentAccessException(javax.ejb.ConcurrentAccessException) RemoveException(javax.ejb.RemoveException) ConcurrentAccessTimeoutException(javax.ejb.ConcurrentAccessTimeoutException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) BackingStoreException(org.glassfish.ha.store.api.BackingStoreException) IOException(java.io.IOException) NotSerializableException(java.io.NotSerializableException) SystemException(javax.transaction.SystemException) CreateException(javax.ejb.CreateException) NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Example 4 with CheckpointAtEndOfMethodDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor in project Payara by payara.

the class CheckpointAtEndOfMethodNode method writeDescriptor.

@Override
public Node writeDescriptor(Node parent, String nodeName, CheckpointAtEndOfMethodDescriptor checkpointMethodDescriptor) {
    Node checkpointMethodNode = super.writeDescriptor(parent, nodeName, checkpointMethodDescriptor);
    ArrayList methodDescs = checkpointMethodDescriptor.getConvertedMethodDescs();
    if (!methodDescs.isEmpty()) {
        MethodNode methodNode = new MethodNode();
        for (Iterator<MethodDescriptor> it = methodDescs.iterator(); it.hasNext(); ) {
            // do not write out ejb-name element for the method
            methodNode.writeDescriptor(checkpointMethodNode, RuntimeTagNames.METHOD, it.next(), null);
        }
    }
    return checkpointMethodNode;
}
Also used : MethodNode(com.sun.enterprise.deployment.node.MethodNode) Node(org.w3c.dom.Node) MethodNode(com.sun.enterprise.deployment.node.MethodNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ArrayList(java.util.ArrayList) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Aggregations

CheckpointAtEndOfMethodDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)4 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)2 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)2 Node (org.w3c.dom.Node)2 InvocationInfo (com.sun.ejb.InvocationInfo)1 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 EjbIORConfigurationDescriptor (com.sun.enterprise.deployment.EjbIORConfigurationDescriptor)1 EjbSessionDescriptor (com.sun.enterprise.deployment.EjbSessionDescriptor)1 RunAsIdentityDescriptor (com.sun.enterprise.deployment.RunAsIdentityDescriptor)1 MethodNode (com.sun.enterprise.deployment.node.MethodNode)1 XMLElement (com.sun.enterprise.deployment.node.XMLElement)1 EjbRefNode (com.sun.enterprise.deployment.node.runtime.EjbRefNode)1 MessageDestinationRefNode (com.sun.enterprise.deployment.node.runtime.MessageDestinationRefNode)1 ResourceEnvRefNode (com.sun.enterprise.deployment.node.runtime.ResourceEnvRefNode)1 ResourceRefNode (com.sun.enterprise.deployment.node.runtime.ResourceRefNode)1 RuntimeDescriptorNode (com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode)1 ServiceRefNode (com.sun.enterprise.deployment.node.runtime.ServiceRefNode)1 WebServiceEndpointRuntimeNode (com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode)1 BeanPoolDescriptor (com.sun.enterprise.deployment.runtime.BeanPoolDescriptor)1 IOException (java.io.IOException)1