Search in sources :

Example 1 with ScheduledTimerDescriptor

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

the class EjbSessionNode method writeDescriptor.

@Override
public Node writeDescriptor(Node parent, String nodeName, EjbSessionDescriptor ejbDesc) {
    Node ejbNode = super.writeDescriptor(parent, nodeName, ejbDesc);
    writeDisplayableComponentInfo(ejbNode, ejbDesc);
    writeCommonHeaderEjbDescriptor(ejbNode, ejbDesc);
    appendTextChild(ejbNode, EjbTagNames.SESSION_TYPE, ejbDesc.getSessionType());
    if (ejbDesc.hasStatefulTimeout()) {
        TimeoutValueNode timeoutValueNode = new TimeoutValueNode();
        TimeoutValueDescriptor timeoutDesc = new TimeoutValueDescriptor();
        timeoutDesc.setValue(ejbDesc.getStatefulTimeoutValue());
        timeoutDesc.setUnit(ejbDesc.getStatefulTimeoutUnit());
        timeoutValueNode.writeDescriptor(ejbNode, EjbTagNames.STATEFUL_TIMEOUT, timeoutDesc);
    }
    MethodNode methodNode = new MethodNode();
    if (ejbDesc.isTimedObject()) {
        if (ejbDesc.getEjbTimeoutMethod() != null) {
            methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.TIMEOUT_METHOD, ejbDesc.getEjbTimeoutMethod());
        }
        for (ScheduledTimerDescriptor timerDesc : ejbDesc.getScheduledTimerDescriptors()) {
            ScheduledTimerNode timerNode = new ScheduledTimerNode();
            timerNode.writeDescriptor(ejbNode, EjbTagNames.TIMER, timerDesc);
        }
    }
    if (ejbDesc.isSingleton()) {
        appendTextChild(ejbNode, EjbTagNames.INIT_ON_STARTUP, Boolean.toString(ejbDesc.getInitOnStartup()));
    }
    if (!ejbDesc.isStateless()) {
        appendTextChild(ejbNode, EjbTagNames.CONCURRENCY_MANAGEMENT_TYPE, ejbDesc.getConcurrencyManagementType().toString());
    }
    for (EjbSessionDescriptor.AccessTimeoutHolder next : ejbDesc.getAccessTimeoutInfo()) {
        ConcurrentMethodDescriptor cDesc = new ConcurrentMethodDescriptor();
        cDesc.setConcurrentMethod(next.method);
        TimeoutValueDescriptor timeoutDesc = new TimeoutValueDescriptor();
        timeoutDesc.setValue(next.value);
        timeoutDesc.setUnit(next.unit);
        cDesc.setAccessTimeout(timeoutDesc);
        ConcurrentMethodNode cNode = new ConcurrentMethodNode();
        cNode.writeDescriptor(ejbNode, EjbTagNames.CONCURRENT_METHOD, cDesc);
    }
    for (MethodDescriptor nextReadLock : ejbDesc.getReadLockMethods()) {
        ConcurrentMethodDescriptor cDesc = new ConcurrentMethodDescriptor();
        cDesc.setConcurrentMethod(nextReadLock);
        cDesc.setWriteLock(false);
        ConcurrentMethodNode cNode = new ConcurrentMethodNode();
        cNode.writeDescriptor(ejbNode, EjbTagNames.CONCURRENT_METHOD, cDesc);
    }
    if (ejbDesc.hasDependsOn()) {
        Node dependsOnNode = appendChild(ejbNode, EjbTagNames.DEPENDS_ON);
        for (String depend : ejbDesc.getDependsOn()) {
            appendTextChild(dependsOnNode, EjbTagNames.EJB_NAME, depend);
        }
    }
    if (ejbDesc.hasInitMethods()) {
        EjbInitNode initNode = new EjbInitNode();
        for (EjbInitInfo next : ejbDesc.getInitMethods()) {
            initNode.writeDescriptor(ejbNode, EjbTagNames.INIT_METHOD, next);
        }
    }
    if (ejbDesc.hasRemoveMethods()) {
        EjbRemoveNode removeNode = new EjbRemoveNode();
        for (EjbRemovalInfo next : ejbDesc.getAllRemovalInfo()) {
            removeNode.writeDescriptor(ejbNode, EjbTagNames.REMOVE_METHOD, next);
        }
    }
    for (MethodDescriptor nextDesc : ejbDesc.getAsynchronousMethods()) {
        methodNode.writeDescriptor(ejbNode, EjbTagNames.ASYNC_METHOD, nextDesc, ejbDesc.getName());
    }
    appendTextChild(ejbNode, EjbTagNames.TRANSACTION_TYPE, ejbDesc.getTransactionType());
    MethodDescriptor afterBeginMethod = ejbDesc.getAfterBeginMethod();
    if (afterBeginMethod != null) {
        methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.AFTER_BEGIN_METHOD, afterBeginMethod);
    }
    MethodDescriptor beforeCompletionMethod = ejbDesc.getBeforeCompletionMethod();
    if (beforeCompletionMethod != null) {
        methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.BEFORE_COMPLETION_METHOD, beforeCompletionMethod);
    }
    MethodDescriptor afterCompletionMethod = ejbDesc.getAfterCompletionMethod();
    if (afterCompletionMethod != null) {
        methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.AFTER_COMPLETION_METHOD, afterCompletionMethod);
    }
    // around-invoke-method
    writeAroundInvokeDescriptors(ejbNode, ejbDesc.getAroundInvokeDescriptors().iterator());
    // around-timeout-method
    writeAroundTimeoutDescriptors(ejbNode, ejbDesc.getAroundTimeoutDescriptors().iterator());
    // env-entry*
    writeEnvEntryDescriptors(ejbNode, ejbDesc.getEnvironmentProperties().iterator());
    // ejb-ref * and ejb-local-ref*
    writeEjbReferenceDescriptors(ejbNode, ejbDesc.getEjbReferenceDescriptors().iterator());
    // service-ref*
    writeServiceReferenceDescriptors(ejbNode, ejbDesc.getServiceReferenceDescriptors().iterator());
    // resource-ref*
    writeResourceRefDescriptors(ejbNode, ejbDesc.getResourceReferenceDescriptors().iterator());
    // resource-env-ref*
    writeResourceEnvRefDescriptors(ejbNode, ejbDesc.getResourceEnvReferenceDescriptors().iterator());
    // message-destination-ref*
    writeMessageDestinationRefDescriptors(ejbNode, ejbDesc.getMessageDestinationReferenceDescriptors().iterator());
    // persistence-context-ref*
    writeEntityManagerReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerReferenceDescriptors().iterator());
    // persistence-unit-ref*
    writeEntityManagerFactoryReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerFactoryReferenceDescriptors().iterator());
    // post-construct
    writeLifeCycleCallbackDescriptors(ejbNode, TagNames.POST_CONSTRUCT, ejbDesc.getPostConstructDescriptors());
    // pre-destroy
    writeLifeCycleCallbackDescriptors(ejbNode, TagNames.PRE_DESTROY, ejbDesc.getPreDestroyDescriptors());
    // all descriptors (includes DSD, MSD, JMSCFD, JMSDD,AOD, CFD)*
    writeResourceDescriptors(ejbNode, ejbDesc.getAllResourcesDescriptors().iterator());
    // post-activate-method
    writeLifeCycleCallbackDescriptors(ejbNode, EjbTagNames.POST_ACTIVATE_METHOD, ejbDesc.getPostActivateDescriptors());
    // pre-passivate-method
    writeLifeCycleCallbackDescriptors(ejbNode, EjbTagNames.PRE_PASSIVATE_METHOD, ejbDesc.getPrePassivateDescriptors());
    // security-role-ref*
    writeRoleReferenceDescriptors(ejbNode, ejbDesc.getRoleReferences().iterator());
    // security-identity
    writeSecurityIdentityDescriptor(ejbNode, ejbDesc);
    // passivation-capable
    if (ejbDesc.isStateful()) {
        appendTextChild(ejbNode, EjbTagNames.PASSIVATION_CAPABLE, Boolean.toString(ejbDesc.isPassivationCapable()));
    }
    return ejbNode;
}
Also used : ScheduledTimerDescriptor(org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor) MethodNode(com.sun.enterprise.deployment.node.MethodNode) MailSessionNode(com.sun.enterprise.deployment.node.MailSessionNode) Node(org.w3c.dom.Node) LifecycleCallbackNode(com.sun.enterprise.deployment.node.LifecycleCallbackNode) DataSourceDefinitionNode(com.sun.enterprise.deployment.node.DataSourceDefinitionNode) ConcurrentMethodDescriptor(org.glassfish.ejb.deployment.descriptor.ConcurrentMethodDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) EjbInitInfo(org.glassfish.ejb.deployment.descriptor.EjbInitInfo) ConcurrentMethodDescriptor(org.glassfish.ejb.deployment.descriptor.ConcurrentMethodDescriptor) MethodNode(com.sun.enterprise.deployment.node.MethodNode) EjbRemovalInfo(org.glassfish.ejb.deployment.descriptor.EjbRemovalInfo) TimeoutValueDescriptor(org.glassfish.ejb.deployment.descriptor.TimeoutValueDescriptor) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)

Example 2 with ScheduledTimerDescriptor

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

the class MessageDrivenBeanNode method writeDescriptor.

@Override
public Node writeDescriptor(Node parent, String nodeName, EjbMessageBeanDescriptor ejbDesc) {
    Node ejbNode = super.writeDescriptor(parent, nodeName, ejbDesc);
    writeDisplayableComponentInfo(ejbNode, ejbDesc);
    writeCommonHeaderEjbDescriptor(ejbNode, ejbDesc);
    appendTextChild(ejbNode, EjbTagNames.EJB_CLASS, ejbDesc.getEjbClassName());
    appendTextChild(ejbNode, EjbTagNames.MESSAGING_TYPE, ejbDesc.getMessageListenerType());
    MethodNode methodNode = new MethodNode();
    if (ejbDesc.isTimedObject()) {
        if (ejbDesc.getEjbTimeoutMethod() != null) {
            methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.TIMEOUT_METHOD, ejbDesc.getEjbTimeoutMethod());
        }
        for (ScheduledTimerDescriptor timerDesc : ejbDesc.getScheduledTimerDescriptors()) {
            ScheduledTimerNode timerNode = new ScheduledTimerNode();
            timerNode.writeDescriptor(ejbNode, EjbTagNames.TIMER, timerDesc);
        }
    }
    appendTextChild(ejbNode, EjbTagNames.TRANSACTION_TYPE, ejbDesc.getTransactionType());
    // message-destination-type
    appendTextChild(ejbNode, TagNames.MESSAGE_DESTINATION_TYPE, ejbDesc.getDestinationType());
    // message-destination-link
    String link = ejbDesc.getMessageDestinationLinkName();
    appendTextChild(ejbNode, TagNames.MESSAGE_DESTINATION_LINK, link);
    ActivationConfigNode activationConfigNode = new ActivationConfigNode();
    activationConfigNode.writeDescriptor(ejbNode, EjbTagNames.ACTIVATION_CONFIG, ejbDesc.getActivationConfigDescriptor());
    // around-invoke-method
    writeAroundInvokeDescriptors(ejbNode, ejbDesc.getAroundInvokeDescriptors().iterator());
    // around-timeout-method
    writeAroundTimeoutDescriptors(ejbNode, ejbDesc.getAroundTimeoutDescriptors().iterator());
    // env-entry*
    writeEnvEntryDescriptors(ejbNode, ejbDesc.getEnvironmentProperties().iterator());
    // ejb-ref * and ejb-local-ref*
    writeEjbReferenceDescriptors(ejbNode, ejbDesc.getEjbReferenceDescriptors().iterator());
    // service-ref*
    writeServiceReferenceDescriptors(ejbNode, ejbDesc.getServiceReferenceDescriptors().iterator());
    // resource-ref*
    writeResourceRefDescriptors(ejbNode, ejbDesc.getResourceReferenceDescriptors().iterator());
    // resource-env-ref*
    writeResourceEnvRefDescriptors(ejbNode, ejbDesc.getResourceEnvReferenceDescriptors().iterator());
    // message-destination-ref*
    writeMessageDestinationRefDescriptors(ejbNode, ejbDesc.getMessageDestinationReferenceDescriptors().iterator());
    // persistence-context-ref*
    writeEntityManagerReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerReferenceDescriptors().iterator());
    // persistence-unit-ref*
    writeEntityManagerFactoryReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerFactoryReferenceDescriptors().iterator());
    // post-construct
    writeLifeCycleCallbackDescriptors(ejbNode, TagNames.POST_CONSTRUCT, ejbDesc.getPostConstructDescriptors());
    // pre-destroy
    writeLifeCycleCallbackDescriptors(ejbNode, TagNames.PRE_DESTROY, ejbDesc.getPreDestroyDescriptors());
    // all descriptors (includes DSD, MSD, JMSCFD, JMSDD,AOD, CFD)*
    writeResourceDescriptors(ejbNode, ejbDesc.getAllResourcesDescriptors().iterator());
    // security-role-ref*
    writeRoleReferenceDescriptors(ejbNode, ejbDesc.getRoleReferences().iterator());
    // security-identity
    writeSecurityIdentityDescriptor(ejbNode, ejbDesc);
    return ejbNode;
}
Also used : ScheduledTimerDescriptor(org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor) Node(org.w3c.dom.Node)

Example 3 with ScheduledTimerDescriptor

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

the class EjbBundleValidator method accept.

/**
 * visits an ejb descriptor
 * @param ejb descriptor
 */
@Override
public void accept(EjbDescriptor ejb) {
    // application
    if (ejb instanceof DummyEjbDescriptor) {
        throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.exceptionbeanbundle", "Referencing error: this bundle has no bean of name: {0}", new Object[] { ejb.getName() }));
    }
    this.ejb = ejb;
    setDOLDefault(ejb);
    computeRuntimeDefault(ejb);
    checkDependsOn(ejb);
    validateConcurrencyMetadata(ejb);
    validateStatefulTimeout(ejb);
    validatePassivationConfiguration(ejb);
    try {
        ClassLoader cl = ejb.getEjbBundleDescriptor().getClassLoader();
        Class ejbClass = cl.loadClass(ejb.getEjbClassName());
        if (Globals.getDefaultHabitat() == null) {
            return;
        }
        if (ejb instanceof EjbSessionDescriptor) {
            EjbSessionDescriptor desc = (EjbSessionDescriptor) ejb;
            if (desc.isClustered()) {
                if (!desc.isSingleton()) {
                    throw new IllegalArgumentException("Only Sinlgeton beans can be Clustered: " + desc.getName());
                }
                if (!Serializable.class.isAssignableFrom(ejbClass)) {
                    throw new IllegalStateException(String.format("Clustered Singleton %s must be Serializable", desc.getName()));
                }
                if (desc.getClusteredLockType() == DistributedLockType.LOCK) {
                    throw new IllegalStateException(String.format("Clustered Singleton %s - incompatible lock type LOCK", desc.getName()));
                }
            }
        }
        // Perform 2.x style TimedObject processing if the class
        // hasn't already been identified as a timed object.
        AnnotationTypesProvider provider = Globals.getDefaultHabitat().getService(AnnotationTypesProvider.class, "EJB");
        if (provider == null) {
            throw new RuntimeException("Cannot find AnnotationTypesProvider named 'EJB'");
        }
        if (ejb.getEjbTimeoutMethod() == null && provider.getType("javax.ejb.TimedObject").isAssignableFrom(ejbClass)) {
            MethodDescriptor timedObjectMethod = new MethodDescriptor("ejbTimeout", "TimedObject timeout method", new String[] { "javax.ejb.Timer" }, MethodDescriptor.TIMER_METHOD);
            ejb.setEjbTimeoutMethod(timedObjectMethod);
        } else if (ejb.getEjbTimeoutMethod() != null) {
            // If timeout-method was only processed from the descriptor,
            // we need to create a MethodDescriptor using the actual
            // Method object corresponding to the timeout method.  The
            // timeout method can have any access type and be anywhere
            // in the bean class hierarchy.
            MethodDescriptor timeoutMethodDescOrig = ejb.getEjbTimeoutMethod();
            MethodDescriptor timeoutMethodDesc = processTimeoutMethod(ejb, timeoutMethodDescOrig, provider, ejbClass);
            ejb.setEjbTimeoutMethod(timeoutMethodDesc);
        }
        for (ScheduledTimerDescriptor sd : ejb.getScheduledTimerDescriptors()) {
            try {
                // This method creates new schedule and attempts to calculate next timeout.
                // The second part ensures that all values that are not verified up-front
                // are also validated.
                // It does not check that such timeout date is a valid date.
                EJBTimerSchedule.isValid(sd);
            } catch (Exception e) {
                throw new RuntimeException(ejb.getName() + ": Invalid schedule " + "defined on method " + sd.getTimeoutMethod().getFormattedString() + ": " + e.getMessage());
            }
            MethodDescriptor timeoutMethodDescOrig = sd.getTimeoutMethod();
            MethodDescriptor timeoutMethodDesc = processTimeoutMethod(ejb, timeoutMethodDescOrig, provider, ejbClass);
            sd.setTimeoutMethod(timeoutMethodDesc);
        }
    } catch (Exception e) {
        RuntimeException re = new RuntimeException("Error processing EjbDescriptor");
        re.initCause(e);
        throw re;
    }
    // has to be derived from target inject method or inject field.
    for (InjectionCapable injectable : ejb.getEjbBundleDescriptor().getInjectableResources(ejb)) {
        accept(injectable);
    }
    for (Iterator itr = ejb.getEjbReferenceDescriptors().iterator(); itr.hasNext(); ) {
        EjbReference aRef = (EjbReference) itr.next();
        accept(aRef);
    }
    for (Iterator it = ejb.getResourceReferenceDescriptors().iterator(); it.hasNext(); ) {
        ResourceReferenceDescriptor next = (ResourceReferenceDescriptor) it.next();
        accept(next);
    }
    for (Iterator it = ejb.getResourceEnvReferenceDescriptors().iterator(); it.hasNext(); ) {
        ResourceEnvReferenceDescriptor next = (ResourceEnvReferenceDescriptor) it.next();
        accept(next);
    }
    for (Iterator it = ejb.getMessageDestinationReferenceDescriptors().iterator(); it.hasNext(); ) {
        MessageDestinationReferencer next = (MessageDestinationReferencer) it.next();
        accept(next);
    }
    // referencer as well.
    if (ejb.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
        if (ejb instanceof MessageDestinationReferencer) {
            MessageDestinationReferencer msgDestReferencer = (MessageDestinationReferencer) ejb;
            if (msgDestReferencer.getMessageDestinationLinkName() != null) {
                accept(msgDestReferencer);
            }
        }
    }
    Set serviceRefs = ejb.getServiceReferenceDescriptors();
    for (Iterator itr = serviceRefs.iterator(); itr.hasNext(); ) {
        accept((ServiceReferenceDescriptor) itr.next());
    }
    if (ejb instanceof EjbCMPEntityDescriptor) {
        EjbCMPEntityDescriptor cmp = (EjbCMPEntityDescriptor) ejb;
        PersistenceDescriptor persistenceDesc = cmp.getPersistenceDescriptor();
        for (Iterator e = persistenceDesc.getCMPFields().iterator(); e.hasNext(); ) {
            FieldDescriptor fd = (FieldDescriptor) e.next();
            accept(fd);
        }
    }
}
Also used : Serializable(java.io.Serializable) Set(java.util.Set) DummyEjbDescriptor(org.glassfish.ejb.deployment.descriptor.DummyEjbDescriptor) ScheduledTimerDescriptor(org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) FieldDescriptor(org.glassfish.ejb.deployment.descriptor.FieldDescriptor) EjbReference(com.sun.enterprise.deployment.types.EjbReference) PersistenceDescriptor(org.glassfish.ejb.deployment.descriptor.PersistenceDescriptor) MessageDestinationReferencer(com.sun.enterprise.deployment.types.MessageDestinationReferencer) InjectionCapable(com.sun.enterprise.deployment.InjectionCapable) Iterator(java.util.Iterator) ResourceEnvReferenceDescriptor(com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor) ResourceReferenceDescriptor(com.sun.enterprise.deployment.ResourceReferenceDescriptor) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) EjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor) AnnotationTypesProvider(org.glassfish.internal.deployment.AnnotationTypesProvider)

Example 4 with ScheduledTimerDescriptor

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

the class ScheduleHandler method processSchedule.

protected HandlerProcessingResult processSchedule(Schedule sch, AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
    for (EjbContext ejbContext : ejbContexts) {
        EjbDescriptor ejbDesc = (EjbDescriptor) ejbContext.getDescriptor();
        if (ElementType.METHOD.equals(ainfo.getElementType())) {
            Method annMethod = (Method) ainfo.getAnnotatedElement();
            // .xml-defined timer method overrides @Schedule
            if (!ejbDesc.hasScheduledTimerMethodFromDD(annMethod)) {
                ScheduledTimerDescriptor sd = new ScheduledTimerDescriptor();
                sd.setSecond(sch.second());
                sd.setMinute(sch.minute());
                sd.setHour(sch.hour());
                sd.setDayOfMonth(sch.dayOfMonth());
                sd.setMonth(sch.month());
                sd.setDayOfWeek(sch.dayOfWeek());
                sd.setYear(sch.year());
                sd.setTimezone(sch.timezone());
                sd.setPersistent(sch.persistent());
                sd.setInfo(sch.info());
                sd.setTimeoutMethod(new MethodDescriptor(annMethod));
                ejbDesc.addScheduledTimerDescriptor(sd);
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("@@@ Found Schedule on " + annMethod);
                    logger.fine("@@@ TimerConfig : " + ((sd.getInfo() != null && !sd.getInfo().equals("")) ? sd.getInfo() : null) + " # " + sd.getPersistent());
                }
            }
        }
    }
    return getDefaultProcessedResult();
}
Also used : ScheduledTimerDescriptor(org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor) EjbContext(com.sun.enterprise.deployment.annotation.context.EjbContext) Method(java.lang.reflect.Method) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) EjbDescriptor(org.glassfish.ejb.deployment.descriptor.EjbDescriptor)

Example 5 with ScheduledTimerDescriptor

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

the class PersistentEJBTimerService method createSchedulesOnServer.

/**
 * Called in a clustered environment to eagerly create automatic persistent timers
 * on the specific server instance.
 */
public void createSchedulesOnServer(EjbDescriptor ejbDescriptor, String server_name) {
    Map<MethodDescriptor, List<ScheduledTimerDescriptor>> schedules = new HashMap<MethodDescriptor, List<ScheduledTimerDescriptor>>();
    for (ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
        MethodDescriptor method = schd.getTimeoutMethod();
        if (method != null && schd.getPersistent()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "... processing " + method);
            }
            List<ScheduledTimerDescriptor> list = schedules.get(method);
            if (list == null) {
                list = new ArrayList<ScheduledTimerDescriptor>();
                schedules.put(method, list);
            }
            list.add(schd);
        }
    }
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "EJBTimerService - creating schedules for " + ejbDescriptor.getUniqueId());
    }
    createSchedules(ejbDescriptor.getUniqueId(), ejbDescriptor.getApplication().getUniqueId(), schedules, server_name);
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "EJBTimerService - finished processing schedules for BEAN ID: " + ejbDescriptor.getUniqueId());
    }
}
Also used : HashMap(java.util.HashMap) ScheduledTimerDescriptor(org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor) List(java.util.List) ArrayList(java.util.ArrayList) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Aggregations

ScheduledTimerDescriptor (org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor)9 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)7 Method (java.lang.reflect.Method)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)3 Collection (java.util.Collection)2 Map (java.util.Map)2 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)2 Node (org.w3c.dom.Node)2 IMap (com.hazelcast.core.IMap)1 EJBTimerSchedule (com.sun.ejb.containers.EJBTimerSchedule)1 TimerPrimaryKey (com.sun.ejb.containers.TimerPrimaryKey)1 InjectionCapable (com.sun.enterprise.deployment.InjectionCapable)1 LifecycleCallbackDescriptor (com.sun.enterprise.deployment.LifecycleCallbackDescriptor)1 ResourceEnvReferenceDescriptor (com.sun.enterprise.deployment.ResourceEnvReferenceDescriptor)1 ResourceReferenceDescriptor (com.sun.enterprise.deployment.ResourceReferenceDescriptor)1 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)1 DataSourceDefinitionNode (com.sun.enterprise.deployment.node.DataSourceDefinitionNode)1