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

Add parent thread field and accessor to Thread

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1
    • core-libs
    • None
    • x86
    • windows_nt



      Name: sgC58550 Date: 05/16/97


      currently, Thread.init() gets currentThread() and stores it to a local
      variable in order to get the "parent" thread's ThreadGroup (in some
      cases). i'd like to request that this be stored in a member field
      and that a get-accessor be added to Thread:
        public class Thread implements Runnable
        {
          ...
          private Thread parent;
          ...
          private void init(...)
          {
            parent = currentThread();
            ...
          }
        }

      generically, information is being passed from the parent thread to
      a child thread; but this information is currently limitted to the
      ThreadGroup. in my project, i extend Thread to store some per-Thread
      information. since i can't force all code (eg awt code) to use my
      special Thread, i'd like instead to be able to trace the "ancestry"
      of any given Thread; if an instance of my Thread subclass is found
      in the ancestry, i'd use that ancestor's stored information.

      this seems to me a very simple and useful addition. for example, in
      an implementation of JavaSoft's JTS, this information could be used
      to enable the default transfer of transaction context information to
      spawned threads.

      i do realize, however, this probably requires VM modifications,
      since Thread is such a low-level class.

      ======================================================================

            jjb Josh Bloch
            sgoodsunw Sheri Good (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: