3 Replies Latest reply on Nov 13, 2002 2:16 PM by Jason Boorn

    java processes on jboss_3.03

    Jason Boorn Newbie

      Apologies if this is a basic EJB question, but I'm going through the EJB spec and I'm not not sure if it addresses the problem specifically . . .

      I'm running an app which creates a large number of CMP beans. Profiling the app (JProfiler) shows that whenever a new CMP is created, it starts up a new java process (Runnable). As there are a large number of CMP beans, there are a large number of java processes created.

      I suspect that the java processes created are containers for the beans, but these processes are not shut down for the life of the server - eventually the server is going to have a large number of processes running at once and memory starts to be an issue.

      Some background -

      The app uses JbossMQ extensively to handle communication. Sometimes the creation of a CMP bean causes other CMP beans to be created (in ejbPostCreate). I can see the passivate call happening, but it doesn't seem to stop the running process associated with the bean itself.


      1. Is ejbPassivate() supposed to shut down the controlling thread for a bean?

      2. Is there a reason why CMP beans created from within a CMP bean would not passivate properly? Is it even legal to spawn a CMP bean from within another?

      3. While profiling, the Runnable threads created have numbers like "Thread - 123." Is there a way to name these Runnable processes so that I can keep track of which containers (if they are indeed the containers) go with which beans?

      This newbie appreciates any help on this, if even a pointer to some docs to look at (I have purchased all the jboss docs)

        • 1. Re: java processes on jboss_3.03
          Adrian Brock Master

          What is the stack trace of Thread-123?


          • 2. Re: java processes on jboss_3.03
            Jason Boorn Newbie

            I looked for this and came across what could be the problem. The MDB's that handle communication in the app spawn threads for specific actions. These are the threads not getting cleaned up.

            Specifically, an MDB spawns a java process (extends Thread) which after doing some stuff spawns an action (which also extends Thread). This last thread calls some CMP beans. The beans are cleaned up fine, the first thread is too, but the second one is not.

            I'm thinking that I'm going to try turning these threads (which might be somehow outside the jboss domain) into Session Beans. I'll let you know if this cleans up the process.

            Thanks for the quick reply.

            • 3. Re: java processes on jboss_3.03
              Jason Boorn Newbie

              Ok, I redid the Threads to make them Sessions, and we're making progress. However, I have a server on the front of the application that needs to spawn a new thread for each incoming socket. This one was still giving me a problem (not cleaning up) after it exited its run method.

              So, I changed it to implement Runnable instead. Still not cleaning up.

              Finally, I set the bloody thing to null after taking it out of the hashtable that was storing it.

              That seems to do the trick. So I'm going to run with that ;)

              Wanted to post this in case you guys are looking at Threads spawned inside the jboss server in the future. I still don't really understand why it fails and works when it does.