1 Reply Latest reply on Jul 13, 2006 9:42 AM by wolfc

    Why SLSB maintain state between method invocation?

    kingofhawks

      Hi:
      I have written a SLSB like following:

      public @Stateless class SwitchHealthMgrBean implements SwitchHealthMgrLocal,SwitchHealthMgrRemote {
      private Logger logger=Logger.getLogger(SwitchHealthMgrBean.class);
      private int count=0;
      public void start() {
      count=1;
      logger.info("Count#"+count);

      }

      public void stop() {
      logger.info("Count#"+count);

      }
      }

      And i have written a client(JSP page) to first invoke start(),second invoke stop(),the logger info indicates that it has maintained state between method invocation!
      Anyone can tell me why?
      Best Regards!
      Kingofhawks

        • 1. Re: Why SLSB maintain state between method invocation?
          wolfc

          JSR 220: Enterprise JavaBeansTM,Version 3.0, Final Release, 4.5 Stateless Session Beans, 2nd paragraph:

          The term ?stateless? signifies that an instance has no state for a specific client. However, the instance
          variables of the instance can contain the state across client-invoked method calls. Examples of such
          state include an open database connection and an object reference to an enterprise bean object.