Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4109242

(thread spec) Thread.activeCount() does not define "active"

XMLWordPrintable

    • generic, unknown
    • generic

      Unclear language speicification make it very hard to define and implement the class java.lang.ThreadGroup()

      1. activeCount(), the API indicates it should return the count of active threads
        in this thread group. But there is no definition active. Actually, the thread
        can be started or stopped, or just exits any time. There is no semantic mean
        for that.

      2. There are 8 methods in the ThreadGroup API have never been implemented. They
         are threadsCount(), allThreadsCount(), groupsCount(), allGroupsCount(),
         threads(), allThreads(), groups(), allGroups()
         Is there any real need for these methods? What is semantics for the methods?
         Is it safe to do so? Since we need to take snapshot of thread group, which
         is likely to prevent a high priority thread to start or stop.

      3. Since most os does not provide equivalent concept, it is very hard to map
         the definition to os primitives.

      We should make the api more clear before we provide the implementation. This bug
      is response for bug 4083644.

            alanb Alan Bateman
            hongzh Hong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: