3 Replies Latest reply: Jun 11, 2009 5:24 PM by 807557 RSS

    ThreadGroups

    807557
      Hello,

      When trying to migrate some applications to RTSJ, I noticed that there is no equivalent to ThreadGroups in the Real-time specification. Is there any special reason for that? Does RTSJ provide an alternative to the use of ThreadGroups?
        • 1. Re: ThreadGroups
          807557
          ThreadGroups are still present and mentioned in the RTSJ - in particular that scope-allocated NHRT/RTT wont be a member of any ThreadGroup.

          Are you referring to the fact that the NHRT/RTT constructors don't let you specify the ThreadGroup? That is true - the ThreadGroup is determined by the ThreadGroup of the current thread (or perhaps the security manager).

          ThreadGroups really serve little purpose in Java and have been allowed to "bit-rot" - their use while not actually deprecated is strongly discouraged (see for example "Effective Java" by Josh Bloch).

          David Holmes
          • 2. Re: ThreadGroups
            807557
            Thank you, David. Actually it's exactly that : we can't specify a ThreadGroup through a RTT constructor. I was wondering if there was something like a method setThreadGroup instead to keep the compatibility, but i don't think so.
            • 3. Re: ThreadGroups
              807557
              jcamerico wrote:
              Thank you, David. Actually it's exactly that : we can't specify a ThreadGroup through a RTT constructor. I was wondering if there was something like a method setThreadGroup instead to keep the compatibility, but i don't think so.
              No, a thread's ThreadGroup is determined at construction time, so if you want threads in specific groups then you have to create them from a thread already in that group.

              What functionality do you want from the ThreadGroup?

              David Holmes