1 Reply Latest reply on Aug 6, 2004 1:16 AM by Scott Stark

    Is Runaway EJB control possible ?

    Frank Griffin Novice

      Sorry if this is a stupid question, but I'm getting asked how a J2EE application can terminate a looping EJB method called under a Message-Driver Bean.

      Everything I read about JMX indicates that it is an essentially passive agent: you can set a property, but unless the looping code voluntarily checks the property and stops itself, you have no ability to interrupt or terminate it.

      I suspect that this is not really an application function, but more the province of a JVMTI tool, and therefore outside of J2EE and not the application's worry. My marketing folks (who are not really familiar with J2EE) are saying "there's gotta be a way to cancel a unit of work", and I can't find any real-world discussion of how J2EE apps do this, if they do it at all.

      How would this be done in a JBoss environment ? Is it even possible ?

        • 1. Re: Is Runaway EJB control possible ?
          Scott Stark Master

          I find it hard to believe you have marketing people speaking of units of work.

          Your right that this is not a j2ee specific issue. Generically how do you cause a thread of execution to break out of this loop:

           long i = 0;
           while( true )
           i ++;

          Getting hold of the thread and invoking stop (which is deprecated, see http://java.sun.com/j2se/1.4.2/docs/api/index.html) or interrupt are not guraneteed to work. The real issue is that java has no reliable capability for stopping a rouge thread.