Package javax.ejb

Examples of javax.ejb.AccessTimeout


    @Override
    public AccessTimeout getDefaultAccessTimeout() {
        // TODO: This has to be configurable.
        // Currently defaults to 5 minutes
        return new AccessTimeout() {
            @Override
            public long value() {
                return 5;
            }
View Full Code Here


     * @param configuration the component configuration
     */
    protected SessionBeanComponent(final SessionBeanComponentConfiguration configuration) {
        super(configuration);

        AccessTimeout accessTimeout = configuration.getBeanLevelAccessTimeout();
        // TODO: the configuration should always have an access timeout
        if (accessTimeout == null) {
            accessTimeout = new AccessTimeout() {
                @Override
                public long value() {
                    return 5;
                }

View Full Code Here

                mergedBean.setBeanLevelLockType(originalBeanLockType);
            }
        }

        // access timeout
        AccessTimeout overrideAccessTimeout = override.getBeanLevelAccessTimeout();
        if (overrideAccessTimeout != null) {
            mergedBean.setBeanLevelAccessTimeout(overrideAccessTimeout);
        } else {
            AccessTimeout originalAccessTimeout = original.getBeanLevelAccessTimeout();
            if (originalAccessTimeout != null) {
                mergedBean.setBeanLevelAccessTimeout(originalAccessTimeout);
            }
        }
View Full Code Here

        // TODO: This should apply to other bean types too (JBoss specific feature) and not just singleton beans
        AccessTimeoutMetaData accessTimeoutMetaData = singletonBeanMetaData.getAccessTimeout();
        if (accessTimeoutMetaData != null) {
            final long timeout = accessTimeoutMetaData.getTimeout();
            final TimeUnit unit = accessTimeoutMetaData.getUnit();
            AccessTimeout accessTimeout = new AccessTimeout() {
                @Override
                public long value() {
                    return timeout;
                }
View Full Code Here

    }

    @Override
    public AccessTimeout getAccessTimeout(Method method) {
        final EJBBusinessMethod ejbMethod = new EJBBusinessMethod(method);
        final AccessTimeout accessTimeout = this.methodAccessTimeouts.get(ejbMethod);
        if (accessTimeout != null) {
            return accessTimeout;
        }
        // check bean level access timeout
        final AccessTimeout beanTimeout = this.beanLevelAccessTimeout.get(method.getDeclaringClass().getName());
        if (beanTimeout != null) {
            return beanTimeout;
        }
        //TODO: this should be configurable
        return new AccessTimeout() {
            @Override
            public long value() {
                return 5;
            }
View Full Code Here

    @Override
    public AccessTimeout getDefaultAccessTimeout() {
        // TODO: This has to be configurable.
        // Currently defaults to 5 minutes
        return new AccessTimeout() {
            @Override
            public long value() {
                return 5;
            }
View Full Code Here

    /**
     * Returns the {@link AccessTimeout} applicable to given method
     */
    public AccessTimeout getAccessTimeout(Method method) {
        final EJBBusinessMethod ejbMethod = new EJBBusinessMethod(method);
        final AccessTimeout accessTimeout = this.methodAccessTimeouts.get(ejbMethod);
        if (accessTimeout != null) {
            return accessTimeout;
        }
        // check bean level access timeout
        final AccessTimeout timeout = this.beanLevelAccessTimeout.get(method.getDeclaringClass().getName());
        if (timeout != null) {
            return timeout;
        }
        return new AccessTimeout() {
            @Override
            public long value() {
                return 5;
            }

View Full Code Here

    }

    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {

        AccessTimeout timeout = (AccessTimeout) ainfo.getAnnotation();

        for (EjbContext ejbContext : ejbContexts) {
            if (ejbContext.getDescriptor() instanceof EjbSessionDescriptor) {

                EjbSessionDescriptor sessionDesc =
                        (EjbSessionDescriptor) ejbContext.getDescriptor();

                if( sessionDesc.isStateless() ) {
                    continue;
                }

                if (ElementType.TYPE.equals(ainfo.getElementType())) {
                    // Delay processing Class-level default until after methods are processed
                    ejbContext.addPostProcessInfo(ainfo, this);
                } else {
                    Method annMethod = (Method) ainfo.getAnnotatedElement();

                    // Only assign access timeout info if the method hasn't already
                    // been processed.  This correctly ignores superclass methods that
                    // are overridden and applies the correct .xml overriding semantics.
                    if(!matchesExistingAccessTimeoutMethod(annMethod, sessionDesc)) {
                     
                        MethodDescriptor newMethodDesc = new MethodDescriptor(annMethod);
                        sessionDesc.addAccessTimeoutMethod(newMethodDesc, timeout.value(),
                                                             timeout.unit());
                    }
                }
            }
        }
View Full Code Here

        // component definition view that are declared on this class.  This will correctly
        // eliminate any overridden methods and provide the most-derived version of each.
        // Use the Class's declared methods list to get the private methods.
       
        Class classAn = (Class)ainfo.getAnnotatedElement();
        AccessTimeout timeoutAnn = (AccessTimeout) ainfo.getAnnotation();

        List<Method> toProcess = new ArrayList<Method>();
        for(Method m : ejbContext.getComponentDefinitionMethods()) {
            if( classAn.equals(m.getDeclaringClass())) {
                toProcess.add(m);
            }
        }
        for(Method m : classAn.getDeclaredMethods()) {
            if( Modifier.isPrivate(m.getModifiers()) ) {
                toProcess.add(m);
            }
        }

        for( Method m : toProcess ) {

            // If the method is declared on the same class as the TYPE-level default
            // and it hasn't already been assigned lock information from the deployment
            // descriptor, set it.
            if( !matchesExistingAccessTimeoutMethod(m, ejbDesc) ) {

                MethodDescriptor newMethodDesc = new MethodDescriptor(m);
                    ejbDesc.addAccessTimeoutMethod(newMethodDesc, timeoutAnn.value(),
                                                   timeoutAnn.unit());
            }
        }

    }
View Full Code Here

        // TODO: This should apply to other bean types too (JBoss specific feature) and not just singleton beans
        AccessTimeoutMetaData accessTimeoutMetaData = singletonBeanMetaData.getAccessTimeout();
        if (accessTimeoutMetaData != null) {
            final long timeout = accessTimeoutMetaData.getTimeout();
            final TimeUnit unit = accessTimeoutMetaData.getUnit();
            AccessTimeout accessTimeout = new AccessTimeout() {
                @Override
                public long value() {
                    return timeout;
                }
View Full Code Here

TOP

Related Classes of javax.ejb.AccessTimeout

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.