5 Replies Latest reply on Jan 7, 2003 10:14 PM by Juha Lindfors

    Does JBoss shutdown cleanly?

    Viktor Mikho Newbie

      I tried to find out whether JBoss waits untill all EJB calls complete on shutdown. This is what I put into Session EJB call:

      try {
      int delay = 1000* 180;
      logger.info("Sleeping for " + (delay/1000) + " sec...");

      logger.info("Done sleeping for " + (delay/1000) + "sec...");
      catch (Throwable ex) {
      logger.error("Exception on sleep() in getMessage():", ex);

      I invoked remotely this method and after first log message appears (Sleeping for 180 secs ...) I attempted to stop JBoss. It does stop but I never see any other messages in my log. ejbRemove() is not invoked in this case either. So, it looks that JBoss just kills this particular thread ?

      Any ideas?

        • 1. Re: Does JBoss shutdown cleanly?
          Viktor Mikho Newbie

          Hmmmm... No answer from anybody.

          I should probably clarify my message. For me (and I believe for any other user) it seems critically alarming.
          Essentially, my understanding is that if your EJB beans are busy doing something then


          They don't have a chance to finish whatever they are doing. I hope that I am doing something stupid because otherwise it is quite scary.
          I run JBoss on Win 2000. Results are the same whether I run it as a service or using startup/shutdown scripts. All other JMX stuff seems to shutdown gracefully. EJBs seem to be cleaned gracefully (ejbRemove is called) as well IF THEY ARE NOT BUSY. Problem appears to happen if EJB is doing something - and this is a worst case scenario because it means that you just can't stop server without of risk to corrupt data.

          Does anyone have any comments?

          • 2. Re: Does JBoss shutdown cleanly?
            Viktor Mikho Newbie

            I forgot to mention that I run JBoss 3.0.4.

            • 3. Re: Does JBoss shutdown cleanly?
              Juha Lindfors Master

              data commits are driven by transactions so there won't be corrupt data in the database

              • 4. Re: Does JBoss shutdown cleanly?
                Viktor Mikho Newbie

                Yep, probably data will be not corrupted.
                But what about hanging connections to database that have requests which are neither commited nor rolled back?
                When such request is done as update on the existing record and Java App is killed then this record is locked by Oracle.

                There are plenty of other unpleasant things that my happen on ungracefull kill. Sure JBOss can do better than kil the bean.

                • 5. Re: Does JBoss shutdown cleanly?
                  Juha Lindfors Master

                  Database connections are managed by the connection pools, not by the container directly, and will shut down as you shut down the server, just like all your other MBeans. In the worst case scenario where a connection is left lingering, it will eventually time out (and even this should not happen, as you see your all mbeans succesfully shut down).

                  You're thinking the EJB container is this big monolith that is in charge of all the resources in the server, and killing it is a bad thing -- it is not. It is merely an in-memory object of the bean state itself. You could wait for all the beans to finish but then there are issues such as when to forcibly kill a deadlocked beans for instance.

                  Since shutdown is not an operation you frequently execute on a production system I don't see this as a big issue as there is no data corruption.