6 Replies Latest reply on Feb 24, 2003 5:40 AM by Simone

    Serialized call HELP!!!

    Simone Newbie

      Hi,
      I have a stateles session EJB that has a method that does call an MBean. I found that calls to this EJB method are executed in serial way. Is it supposed to be like this?
      This is my code.

      Thank you very much!

      Simone
      public String executeCommand(com.db.jbozz.farming.command.Command command)
      throws WrapperException
      {
      String objectNameString = "jboss.farming:service=FarmHandPoolService";

      MBeanServer mbeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
      Object[] params = new Object[] {command};
      String[] signature = {"com.db.jbozz.farming.command.Command"};
      try
      {
      logger.info("Executing command...");
      ObjectName objectName = new ObjectName(objectNameString);
      return (String) mbeanServer.invoke(objectName, "executeCommand",
      params, signature);
      }
      catch(Exception e)
      {
      e.printStackTrace();//to be deleted
      logger.error("Error calling executeCommand on MBean " +
      e.getMessage());
      throw new WrapperException("Error calling executeCommand on MBean " +
      e.getMessage(),
      e);

      }
      }

        • 1. Re: Serialized call HELP!!!
          Adrian Brock Master

          Yes

          Are you sure you aren't confusing an
          MBean - Managed Bean with an
          MDB - Message Driven Bean

          Regards,
          Adrian

          • 2. Re: Serialized call HELP!!!
            Simone Newbie

            Hi,

            Thanks for your reply!I use 3.2.0 RC1. I may miss something but what I am trying to do is I have an MBean (not Message Driven Bean) that manages and acts as controller for a pool of RMI servers that execute JNI commands. My idea is to have my client to call the EJB which in turn ask the MBean to execute the command to one of its RMI servers. Now I almost have one request per second and need to have parallel processing. If the MBean server soemehow serializes everything I am out of the game... Please could you confirm me that the MBean server serializes every request? If yes any better design idea?

            Thanks very much!!!!

            • 3. Re: Serialized call HELP!!!
              Adrian Brock Master

              MBeanServer.invoke() performs the operation and
              returns, there is no asynchronicity.

              MDBs are designed for asynchronous processing.

              Of course an MBean can hand off to a background thread
              or thread pool to process asynchronously.
              JBoss4 has an asynchronous NotificationBroadcaster
              implementation that does just that.

              Regards,
              Adrian

              • 4. Re: Serialized call HELP!!!
                Simone Newbie

                Hi,

                I do not need to act asynchronously but syncronosly. My problem is that all the calls to MBeanServer.invoke() appers to be queed and served one by one. I need parallel synchrounous processing. Is this possible with the MBean? Thanks for your patience!!

                Simone

                • 5. Re: Serialized call HELP!!!
                  Adrian Brock Master

                  I understand what you are talking about now.

                  Outside -> Stateless Session Bean -> MBean
                  can be run in parallel, there is no locking or queueing.

                  If it is not working in parallel, I suggest you take
                  a thread dump to find out where the threads are waiting.

                  Regards,
                  Adrian

                  • 6. Re: Serialized call HELP!!!
                    Simone Newbie

                    Thank you very much! Got the thread dump and it was the QueuedPessimisticEJBLock that was causing the serialization. I will now have to move to JDBCOptimisticLock. Thanks again for pointing me in the right direction.

                    Simone