jsr345-experts@ejb-spec.java.net

[jsr345-experts] [Fwd: [ejb-spec issues] [JIRA] Commented: (EJB_SPEC-9) Introduction of @MaxConcurrency annotation]

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 03 May 2012 12:06:05 -0700

Experts,

Do you:
a) agree with the proposal
b) disagree with the proposal
c) have another proposal (please provide one)
d) would like to modify the proposal (be specific in this case)

thanks,
-marina

-------- Original Message --------
Subject: [ejb-spec issues] [JIRA] Commented: (EJB_SPEC-9) Introduction
of @MaxConcurrency annotation
Date: Thu, 3 May 2012 05:24:22 +0000 (GMT+00:00)
From: abien (JIRA) <jira-no-reply_at_java.net>
Reply-To: issues_at_ejb-spec.java.net
To: issues_at_ejb-spec.java.net



    [ http://java.net/jira/browse/EJB_SPEC-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=338919#action_338919 ]

abien commented on EJB_SPEC-9:
------------------------------

Proposal:

@MaxConcurrency annotation as well as the <max-concurrency> element in the ejb-jar.xml specify the maximum number of requests handled by a given bean class. After the configured number of concurrent requests is reached, the container throws a javax.ejb.MaxConcurrencyExceededException. A @MaxConcurrency value of -1 indicates an infinite amount of concurrency. Max Concurrency applies on classes, to specify per bean concurrency, as well as @Asynchronous methods. Max Concurrency is neither applicable on synchronous methods [I guess without this restriction, the feature would be harder to implement by the container provider], nor on @Singleton beans.



public class MaxConcurrencyExceededException extends EJBException{

    public MaxConcurrencyExceededException(String message, Exception ex) {
        super(message, ex);
    }

    public MaxConcurrencyExceededException(Exception ex) {
        super(ex);
    }

    public MaxConcurrencyExceededException(String message) {
        super(message);
    }

    public MaxConcurrencyExceededException() {
    }
    
}


@Documented
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface MaxConcurrency {
    /**
     * Specifies the maximum concurrency of an EJB or asynchronous method <br/>
     * -1 is the default. A negative value means infinite number of requests.
     */
    int value() default -1;
}

Default: -1 infinite.

> Introduction of @MaxConcurrency annotation
> ------------------------------------------
>
> Key: EJB_SPEC-9
> URL: http://java.net/jira/browse/EJB_SPEC-9
> Project: ejb-spec
> Issue Type: New Feature
> Affects Versions: 3.2
> Reporter: abien
> Attachments: MaxConcurrency.zip
>
>
> Currently proprietary max-pool-size settings are used to control the max concurrency of an application and so to prevent overloading the application server.
> We could abstract the intended behavior into an annotation:
> @Target(value = {ElementType.METHOD, ElementType.TYPE})
> @Retention(value = RetentionPolicy.RUNTIME)
> public @interface MaxConcurrency {
> public int value() default 30;
> }
> We could provide more generic annotation like:
> @Target(value = {ElementType.METHOD, ElementType.TYPE})
> @Retention(value = RetentionPolicy.RUNTIME)
> public @interface Concurrency {
> public int max() default 30;
> }
> to support future extensions.
> This functionality should be available for EJB 3.2 and CDI.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira