1. ejb-spec
  2. EJB_SPEC-113

Standardize Pooling and Decouple from EJB Component Model


    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      Instance pooling is currently a non-standard service provided by default to EJB @Stateless beans implicitly by most containers. As a result, although very useful for scalable, reliable mission critical systems this feature is ill understood and ill used.

      This is a proposal to introduce a new annotation for the container instance pooling feature and simultaneously decoupling it from the EJB component model as a generally useful service for suitable managed beans, including CDI beans.

      The programming model could look something like this:

      @Pooled(minPoolSize="...", maxPoolSize="...", ...)
      public class MyScalableService {

      This could be it's own (CDI) bean scope - which would make implementation relatively simple. However, I think it would be useful as a generic declarative service that works with various bean scopes perhaps like the following:

      • Default (dependent) scope - create bean instances, pool them and destroy them as needed.
      • @RequestScoped/@SessionScoped/@ConversationScoped/@ViewScoped - Do the life-cycle callbacks at the beginning and end of requests/sessions/conversations/views, but don't actually discard the instance and pool/reuse them instead.
      • @ApplicationScoped/@Singleton - does not make any semantic sense, but perhaps could work with something like @MaxConcurrency that's simply useful for bandwidth/concurrency throttling and not instance pooling.

      Do let me know if anything needs to be explained further - I am happy to help.

      Please note that these are purely my personal views and certainly not of Oracle's as a company.


        No work has yet been logged on this issue.


          • Assignee:
          • Votes:
            11 Vote for this issue
            4 Start watching this issue


            • Created: