Search in sources :

Example 1 with StatefulTimeoutInfo

use of org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo in project wildfly by wildfly.

the class StatefulTimeoutMergingProcessor method handleDeploymentDescriptor.

@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final SessionBeanMetaData data = componentConfiguration.getDescriptorData();
    if (data == null) {
        return;
    }
    if (data instanceof SessionBean31MetaData) {
        SessionBean31MetaData sessionBean31MetaData = (SessionBean31MetaData) data;
        final StatefulTimeoutMetaData statefulTimeout = sessionBean31MetaData.getStatefulTimeout();
        if (statefulTimeout != null) {
            TimeUnit unit = TimeUnit.MINUTES;
            if (statefulTimeout.getUnit() != null) {
                unit = statefulTimeout.getUnit();
            }
            componentConfiguration.setStatefulTimeout(new StatefulTimeoutInfo(statefulTimeout.getTimeout(), unit));
        }
    }
}
Also used : SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) StatefulTimeoutInfo(org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo) TimeUnit(java.util.concurrent.TimeUnit) StatefulTimeoutMetaData(org.jboss.metadata.ejb.spec.StatefulTimeoutMetaData) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 2 with StatefulTimeoutInfo

use of org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo in project wildfly by wildfly.

the class StatefulTimeoutMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    //we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<StatefulTimeout, StatefulTimeoutInfo> timeout = clazz.getAnnotationInformation(StatefulTimeout.class);
    if (timeout == null) {
        return;
    }
    if (!timeout.getClassLevelAnnotations().isEmpty()) {
        componentConfiguration.setStatefulTimeout(timeout.getClassLevelAnnotations().get(0));
    }
}
Also used : StatefulTimeoutInfo(org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo) StatefulTimeout(javax.ejb.StatefulTimeout) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Example 3 with StatefulTimeoutInfo

use of org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo in project wildfly by wildfly.

the class StatefulTimeoutAnnotationInformationFactory method fromAnnotation.

@Override
protected StatefulTimeoutInfo fromAnnotation(final AnnotationInstance annotationInstance, final PropertyReplacer propertyReplacer) {
    final long value = annotationInstance.value().asLong();
    final AnnotationValue unitValue = annotationInstance.value("unit");
    final TimeUnit unit;
    if (unitValue != null) {
        unit = TimeUnit.valueOf(unitValue.asEnum());
    } else {
        unit = TimeUnit.MINUTES;
    }
    return new StatefulTimeoutInfo(value, unit);
}
Also used : StatefulTimeoutInfo(org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo) AnnotationValue(org.jboss.jandex.AnnotationValue) TimeUnit(java.util.concurrent.TimeUnit)

Aggregations

StatefulTimeoutInfo (org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo)3 TimeUnit (java.util.concurrent.TimeUnit)2 StatefulTimeout (javax.ejb.StatefulTimeout)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 AnnotationValue (org.jboss.jandex.AnnotationValue)1 SessionBean31MetaData (org.jboss.metadata.ejb.spec.SessionBean31MetaData)1 SessionBeanMetaData (org.jboss.metadata.ejb.spec.SessionBeanMetaData)1 StatefulTimeoutMetaData (org.jboss.metadata.ejb.spec.StatefulTimeoutMetaData)1