1 2 3 Previous Next 41 Replies Latest reply on Sep 7, 2011 1:23 PM by wolfc Go to original post
      • 15. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
        aravindsk

        I modified the SingletonBean as you or spec suggests: but i still see the synchronous calls to SLSBs and only one SLBS in the pool

        12:02:34,156 INFO  [STDOUT] TIMEOUT METHOD CALLED
        12:03:02,343 INFO  [STDOUT] MetavanteProcess MetavanteProcess
        12:03:02,390 INFO  [STDOUT] TIMEOUT METHOD CALLED
        12:03:15,343 INFO  [STDOUT] MetavanteProcess MetavanteProcess
        12:03:15,343 INFO  [STDOUT] TIMEOUT METHOD CALLED
        12:03:29,093 INFO  [STDOUT] MetavanteProcess MetavanteProcess
        12:03:29,093 INFO  [STDOUT] TIMEOUT METHOD CALLED
        12:03:38,421 INFO  [STDOUT] MetavanteProcess MetavanteProcess
        12:03:38,421 INFO  [STDOUT] TIMEOUT METHOD CALLED

         

        @Startup

        @Singleton

        @Lock(LockType.READ)

        public class SingletonScheduleBean {

        String item = "MySchedule";

         

        @Resource

        TimerService timerService;

         

        @EJB

        SLSBean processBean;

         

        @Inject

        private Logger logger;

         

        @PostConstruct

        public void init() {

        for (Object obj : timerService.getTimers()) {

        javax.ejb.Timer timer = (javax.ejb.Timer) obj;

        String scheduled = (String) timer.getInfo();

        if (scheduled.equals(item)) {

        timer.cancel();

        }

        }

        timerService.createTimer(1 * 60 * 1000, 1*2* 1000, item);

        }

         

        @Timeout

        public void process(javax.ejb.Timer timer) {

        System.out.println("TIMEOUT METHOD CALLED");

        try {

        processBean.process(timer,item);

        } catch (Exception e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

        }

        }

         

        }

         

        thanks for the comments. but in my example Singleton is not trying to do any WRITES is  it? all the business logic is in SLSBean that this singleton delegates to and that to slsb call that singleton calls is  @Asynchronous slbs.process(). my question what is that i need to configure in the interseptors some where where SLSB injected in Singleton are not treaded like regular beans and handle with multiple pool instances when ever a method is invoked by the container ( timeout) or by the calller.

         

         

        12:02:34,156 INFO  [STDOUT] TIMEOUT METHOD CALLED

         

        12:03:02,343 INFO  [STDOUT] process complete in slsb

         

        12:03:02,390 INFO  [STDOUT] TIMEOUT METHOD CALLED

         

        12:03:15,343 INFO  [STDOUT] process complete in slsb

         

        12:03:15,343 INFO  [STDOUT] TIMEOUT METHOD CALLED

         

        12:03:29,093 INFO  [STDOUT] process complete in slsb

         

        12:03:29,093 INFO  [STDOUT] process complete in slsb

         

        12:03:38,421 INFO  [STDOUT] process complete in slsb

         

        12:03:38,421 INFO  [STDOUT] TIMEOUT METHOD CALLED

        • 16. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
          jaikiran

          aravind kopparthi wrote:

           

          thanks for the comments. but in my example Singleton is not trying to do any WRITES is  it? all the business logic is in SLSBean that this singleton delegates to and that to slsb call that singleton calls is  @Asynchronous slbs.process().

          The EJB3 container has no way to know what you have in your impl of that method. Unless you explicitly specify as a READ lock, it's by default treated for WRITE lock.

           

          aravind kopparthi wrote:

           

          my question what is that i need to configure in the interseptors some where where SLSB injected in Singleton are not treaded like regular beans and handle with multiple pool instances when ever a method is invoked by the container ( timeout) or by the calller.

           

          Just mark that timeout method on the singleton to be READ lock type:

           

          import javax.ejb.Lock;
          import javax.ejb.LockType;
          
          @Lock(LockType.READ)
          @Timeout
          public void process(javax.ejb.Timer timer) {
          ...
          

           

           

          If you want READ lock to apply to all business methods in that singleton bean, then specify that annotation on the EJB bean class level.

          • 17. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
            aravindsk

            i did modify the code i attached in the previous reply. no luck i still see the synchronous calls made to slsb and that to only one instance in the pool.

             

            @Startup

            @Singleton

            @Lock(LockType.READ)

            public class SingletonScheduleBean {

            String item = "MySchedule";

            ...

            • 18. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
              jaikiran

              aravind kopparthi wrote:

               

              I modified the SingletonBean as you or spec suggests: but i still see the synchronous calls to SLSBs

               

              See Carlo's reply in this thread, a few posts back. He's pointed to a JIRA about @Asynchornous.

              • 19. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                aravindsk

                i did look at the link that he provided. Carlo's suggested to change the pool impl to StrictMaxPool and i gave 7. insteadof using ThreadLocalPool. no luck. may be i did not configure correctly? below snippet is what i modified in ejb3-interseptors-aop.xml for stateless bean domain node..

                 

                isn;t this what i needed to modify based on his comments?

                 

                <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
                          @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=7,   timeout=10000)
                      </annotation>

                • 20. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                  jaikiran
                  • 21. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                    aravindsk

                    i did not look at that one. i removed @Asynchronous on slsb's method call. but no luck

                     

                    can you tell me when timeout method gets called by the container in this case process method in singletonBean calls  a method on SLSBean's process method. at this time slsbeans instance gets activated by the container and give's that instance to this method call , during this process when a timout gets triggered doesn't it get a reference to another slsb instance to process?

                    • 22. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                      aravindsk

                      MDB is the only option i have at this time with 6.0  CR1 release? or @Asynchronous will be roughly targeted for next month Final release at least ?.

                      i am still looking for a way to increase the Maxpool size for SLSBs.

                      • 23. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                        jaikiran

                        aravind kopparthi wrote:

                         

                         

                        can you tell me when timeout method gets called by the container in this case process method in singletonBean calls  a method on SLSBean's process method. at this time slsbeans instance gets activated by the container and give's that instance to this method call , during this process when a timout gets triggered doesn't it get a reference to another slsb instance to process?

                        Like I have been saying previously, the second instance of SLSB will only be created if the first instance is in use. So one the 1st timeout on the Singleton bean, you invoke on a SLSB. This results in the creation of the 1st instance of SLSB. *If*  the next timeout invocation happens on the singleton bean before the 1st invocation on that SLSB has completed, *only then* will a new instance be created for the SLSB.

                         

                        As you saw from your logs, the 2nd timeout invocation on the singleton is *not* happening before the 1st invocation finishes. This is due to the fact that you have (by default) configured your singleton bean to be Lock.WRITE type. Change the lock attribute to Lock.READ on that method. That will allow the 2nd timeout on the Singleton to happen while the first invocation on the SLSB is in progress (assuming the SLSB.process is a long running job compared to the timeout interval).

                        • 24. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                          jaikiran

                          aravind kopparthi wrote:

                           

                          MDB is the only option i have at this time with 6.0  CR1 release?

                          Based on what I have seen in this thread, I have no clue what exactly your usecase is. You've got a timer - which implies one kind of asynchronous invocation. Then you have got a singleton which invokes on a @Asynchronous method of a SLSB. And now you are talking about MDB

                           

                          aravind kopparthi wrote:

                           

                          or @Asynchronous will be roughly targeted for next month Final release at least ?.

                           

                          Yes, it will be available in 6.0 Final.

                           

                          aravind kopparthi wrote:


                          i am still looking for a way to increase the Maxpool size for SLSBs.

                          Are you sure you are looking for a way to increase the Maxpool size? Or are you wondering why the number of instances created for the SLSB is just 1?

                          • 25. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                            aravindsk

                            i was referring to MDB only because currently @Asynchronous is not available at EJB level. my actual question remains unchanged interms of what i am looking for @Asynchronous on SLSB that i introduced because of the fact that SingletonBean's timeout did not choose/pick the new instance of SLSB what it is referencing instead @timout method was blocked until the previous(timout expiration event) slsbs method completed.

                            • 26. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                              jaikiran

                              aravind kopparthi wrote:

                               

                              because of the fact that SingletonBean's timeout did not choose/pick the new instance of SLSB what it is referencing instead @timout method was blocked until the previous(timout expiration event) slsbs method completed.

                              Did you try changing the Lock attribute which I explained in some of my previous posts?

                              • 27. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                                aravindsk

                                yes, i did.

                                 

                                @Startup

                                @Singleton

                                @Lock(LockType.READ)

                                public class SingletonScheduleBean {

                                String item = "MySchedule";

                                ...

                                • 28. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                                  jaikiran

                                  And you are still seeing the same blocking behaviour? Can you post the new logs with this change?

                                  • 29. Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
                                    aravindsk

                                    yes, i am still seeing that blocking:

                                    http://community.jboss.org/message/572522#572522