0 Replies Latest reply on Apr 15, 2010 10:35 AM by soma13

    How to set number of min/max beans in pool (session ejb)

    soma13

      Dear all,

       

      I would like to get some help about configuration of session ejb.

       

      I have made a session ejb and it is working well. Now I want to limit its number of min/max beans in pool. I spent lot of time about this topic but I do know to solve it without any help.

       

      my sources:

       

      interface (SenderInterface.java):

      public interface SenderInterface
      {
          public boolean send(Message message) throws Exception;
      }

       

      ejb (EmailSender.java):

      @Stateless
      @Remote(SenderInterface.class)
      @RemoteBinding(jndiBinding="/ejb/sender/emailSender")
      public class EmailSender implements SenderInterface
      {
          /**
           *
           * @return
           * @throws Exception
           */
          public boolean send(Message message) throws Exception
          {
              return false;
          }
      }

       

      After I deployed this ejb to JBoss 5.1 I can use it:

      public static void main(String[] args) throws Exception
      {
          Message message = null;


          // ejb call
          InitialContext ctx = ContextHandler.getInitialContext();
          SenderInterface sender = (SenderInterface) ctx.lookup( "/anitas/sender/emailSender" );
          System.out.println( sender.send(message) );

          System.out.println("---- E N D ----");

      }

       

      On the jmx console I can see the value of mbean attributes:

      (jboss.j2ee -> ear=email-sender.ear,jar=email-sender.ear,name=EmailSender,service=EJB3)

       

      CurrentSize = 0

      MaxSize = 30

      AvailableCount = 30

       

      I think, I can see the good mbean view page because after I have called my ejb the number of CurrentSize is increase to 1.

       

      Now I want to limit number of MaxSize and MinSize of my ejb instance. I modified jboss.xml, but the value of attributes are not changed.

       

      jboss.xml:

      <jboss>
          <container-configurations>
              <container-configuration>
                  <container-name>Standard Stateless SessionBean</container-name>
                  <container-pool-conf>
                      <MaximumSize>10</MaximumSize>
                  </container-pool-conf>
              </container-configuration>
          </container-configurations>
      </jboss>

       

      Structure of my ear:

      my.ear

      |- META-INF

      |    |- ...

      |- lib

           |- my.jar (my ejb)

                 |- META-INF

                    |- jboss.xml

       

       

       

       

      Could you tell me what is wrong in my jboss.xml?

       

      thx.