Name of the Parent Thread.

How can I know the name of the parent thread( not the threadgroup). If I create any theads in the main() function...these threqads have to be spawned by the main.Thread. How can I get the name of the Parent thread which has spawned my thread?
Thank you.

the 0th element of the ".getParent()" call on the current threads threadGroup?
Doesn't seem to be a formal way, but you could create a system by extending the Thread class.

Similar Messages

  • How can we retrieve the name of the Parent Space from the subspace?

    We wish to use a hyperlink in a subspace template which allows a user to link back from the subspace to its parent space.
    This hyperlink should show the name of the parent space.
    These Expression Language Expressions return parent information, but they so not show the Name of the parent space or other details like the Parent Space URL.
    #{spaceContext.currentSpace.parent}
    #{spaceContext.space['bpo'].parent}
    How can we retrieve the name of the Parent Space?

    I agree!
    I can't top this approach.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Moving a file from a directory with the same name to the parent

    Hello,
    I created a directory with the name a.txt and put a file in there called a.txt.
    (This was an accident, I had originally tried to just save a file a.txt in the a.txt directory's parent directory.)
    So I had parent->a.txt->a.txt.
    Then using finder I dragged the a.txt file into the parent directory.
    The replace file dialog came up, as I would expect, to replace the a.txt directory with the a.txt file.
    I clicked replace.
    Then both the directory a.txt and the file a.txt went missing.
    They're not in the Trash.
    The a.txt file is not in the parent directory.
    I understand that there is an underlying process behind moving/replacing/etc., and I understand what I was trying to do is unusual, but this is just crap design.
    PS: I can replicate the problem.
    PSS: I'm using Lion.
    Ian

    Yes.  I also reproduced this.  Looks like a bug.
    You can file a bug report at: http://www.apple.com/feedback/macosx.html

  • Query the name of the parent table in a foreign key constraint

    Hello,
    Does anyone know how to query for the parent table name in a foreign key constraint? I don't see that relationship in ALL_CONS_COLUMNS or ALL_CONSTRAINTS.
    Thanks in advance,
    Michael

    or try this...
    SELECT rc.TABLE_NAME "PK_Table_Name",cc.TABLE_NAME "FK_Table_Name",
           case when cc.column_name = rc.column_name
                then c.TABLE_NAME || '(' || cc.COLUMN_NAME || ')'
                else r.TABLE_NAME || '(' || rc.COLUMN_NAME || ') = ' ||c.TABLE_NAME || '(' || cc.COLUMN_NAME || ')' end as "TABLE_NAME(COLUMN_NAME)"
    from all_constraints c,
         all_constraints r,
         all_cons_columns cc,
         all_cons_columns rc
    WHERE
         r.table_name = upper('emp')
    and      c.CONSTRAINT_TYPE = 'R'
    and     c.R_OWNER = r.OWNER
    and     c.R_CONSTRAINT_NAME = r.CONSTRAINT_NAME
    and     c.CONSTRAINT_NAME = cc.CONSTRAINT_NAME
    and     c.OWNER = cc.OWNER
    and     r.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
    and     r.OWNER = rc.OWNER
    and     cc.POSITION = rc.POSITION
    ORDER BY r.TABLE_NAME;

  • How to get the name of the file parent

    Hi,
    i have a file in this location
    File file = new File(MyFile.doc)
    file.getParent(); returns
    C:\Documents and Settings\Administrator\xyz
    now from the string obtained i just want to get the value "xyz".i.e. i want to get the name of the parent directory.
    how is it possible

    You may use String.indexOf()if(file.getParent().indexOf("/myProject/myPackage") != -1) {
        ...Or you might use regular expressions and Matcher class (or String.matches()) in case of higher complexity.

  • Catching Exception in Parent Thread

    Hi Pros,
    I have a thread having try-catch block. Whatever exception I am catching into catch block should be thrown to be handled by Parent thread.
    Is there any way to do this.
    Thanks,
    Abhijit

    You can't literally throw to the parent thread per se, and the concept of doing so doesn't really make any sense. But using UncaughtExceptionHandler, you can give some control to the parent thread.
    package scratch;
    public class Uncaught {
      public static void main (String[] args) throws Exception {
        Thread t = new Thread(new MyRunnable());
        Thread.UncaughtExceptionHandler eh = new MyUEH ();
        t.setUncaughtExceptionHandler (eh);
        t.start();
      static class MyRunnable implements Runnable {
        @Override
        public void run () {
          System.out.println ("Thread name is: " + Thread.currentThread ().getName ());
          throw new RuntimeException("Can't catch me, I'm the gingerbread thread!");
      static class MyUEH implements Thread.UncaughtExceptionHandler {
        @Override
        public void uncaughtException (final Thread t, final Throwable e) {
          System.err.println ("The uncaught exception stack trace for Thread " + t.getName() + " is: ");
          e.printStackTrace ();
    }

  • Why can't I interrupt the main thread from a child thread with this code?

    I am trying to find an elegant way for a child thread (spawned from a main thread) to stop what its doing and tell the main thread something went wrong. I thought that if I invoke mainThread.interrupt() from the child thread by giving the child thread a reference to the main thread, that would do the trick. But it doesn't work all the time. I want to know why. Here's my code below:
    The main class:
    * IF YOU RUN THIS OFTEN ENOUGH, YOU'LL NOTICE THE "Child Please!" MESSAGE NOT SHOW AT SOME POINT. WHY?
    public class InterruptingParentFromChildThread
         public static void main( String args[] )
              Thread child = new Thread( new ChildThread( Thread.currentThread() ) );
              child.start();
              try
                   child.join();
              catch( InterruptedException e )
    // THE LINE BELOW DOESN'T GET PRINTED EVERY SINGLE TIME ALTHOUGH IT WORKS MOST TIMES, WHY?
                   System.out.println( "Child please!" );
              System.out.println( "ALL DONE!" );
    The class for the child thread:
    public class ChildThread implements Runnable
         Thread mParent;
         public ChildThread( Thread inParent )
              mParent = inParent;
         public void run()
              System.out.println( "In child thread." );
              System.out.println( "Let's interrupt the parent thread now." );
              // THE COMMENTED OUT LINE BELOW, IF UNCOMMENTED, DOESN'T INVOKE InterruptedException THAT CAN BE CAUGHT IN THE MAIN CLASS' CATCH BLOCK, WHY?
              //Thread.currentThread().interrupt();
              // THIS LINE BELOW ONLY WORKS SOMETIMES, WHY?
              mParent.interrupt();
    }

    EJP wrote:
    I'm not convinced about that. The wording in join() suggests that, but the wording in interrupt() definitely does not.Thread.join() doesn't really provide much in the way of details, but Object.wait() does:
    "throws InterruptedException - if any thread interrupted the current thread +before+ or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown."
    every jdk method i've used which throws InterruptedException will always throw if entered while a thread is currently interrupted. admitted, i rarely use Thread.join(), so it's possible that method could be different. however, that makes the thread interruption far less useful if it's required to hit the thread while it's already paused.
    a simple test with Thread.sleep() confirms my expected behavior (sleep will throw):
    Thread.currentThread().interrupt();
    Thread.sleep(1000L);

  • Communicating between the parent and child windows in Struts

    Hey,
    I would like to know what is the best way to communicate between the child and parent windows on a struts based web application. For example i have a struts based jsp page. I call a child window from this page. On the child window i select few values and they have to be shown on the parent. What is the best way to achieve this in struts.
    Thanks
    in advance.
    KM

    The only way to do this without Javascript is to have the child window have a form and the form has a target defined as the name of the parent window (how to name it without using frames or having it open from another window, I'm not sure), and when you submit the form, it'll submit to the parent window/frame and you can process that form on the server and return the same parent page with the selected values.
    Otherwise, you need Javascript to set form values to "window.opener" from the child window.
    Either way, it's not really a Struts thing, technically.

  • Can a parent thread kill a child thread?

    I'm writing a multi-threaded application in which it is possible for one of the threads to go into an infinite loop. Is there any way for a parent thread to actually kill the child thread that has gone into the infinite loop? Of course the parent thread won't actually be able to discern whether or not the child thread is in an infinite loop. I would specify some time out value, and when it has been exceeded, then I would want to kill the child thread. Is this possible without setting any sort of flag that the child would read, because once it gets stuck inside an infinite loop, there will be no way to read the flag.

    Here's an example of a program that I wrote to simply ping a server. It works somewhat backwards from what you were looking for (the child interrupts the parent) but should provide some clue:
    import java.net.*;
    import java.io.*;
    import java.util.Date;
    public class ServerPing extends Thread {
      String [] args;
      public static void main(String[] args) throws Exception {
        ServerPing sp = new ServerPing(args);
        sp.start();
      ServerPing(String [] args) {
        this.args = args;
      public void run() {
        Pinger pinger = new Pinger(this);
        pinger.start();
        try {
          sleep(30000);
        catch (InterruptedException x) {
          System.exit(0); // this is ok. It means the pinger interrupted.
        System.out.println("TIMEOUT");
        System.exit(1);
    class Pinger extends Thread {
      Thread p = null;
      Pinger (Thread p) {
        this.p = p;
      public void run() {
        try {
          URL simpleURL = new URL("http://localhost:7001/ping.jsp");
          BufferedReader in = new BufferedReader(new InputStreamReader(simpleURL.openStream()));
          String inputLine;
          while ((inputLine = in.readLine()) != null)
          System.out.println(inputLine);
          in.close();
          p.interrupt();   // <<-- interrupt the parent
        catch (Exception x) {
          x.printStackTrace();
    }

  • How can I figure out the parent of a thread???

    Hey guys!!!
    I have a tiny question!!
    I have a thread which could be run by 1 of 2 different parents.
    So my idea was to set a variable...for example int a...and initialize it with 1 for the first parent and with 2 for the seond...then in the thread I make if...else...and whether a is 1 or 2 I know who the parent is.
    So what I wanna know is:
    Is there a method which can figure out who of those 2 the parent started the thread without using a variable???
    cheers,
    Tom

    You code do that or if both parents implement some
    interface, call it parentInterface have them pass them selfs in ... and the thread store that as part of its context.
    Then provide a method call it getParent which returns that parent object. And even a getParentName.
    interface parentInterface
      public String getName();
    } // parentInterface
    class myThread extends Thread
      public myThread(parentInterface pi)
        pInterface = pi;
      } // myThread
      public String getParentName()
          return pInterface.getName();
      } // getParentName
      parentInterface pInterface = null;
    } // myThread
    class parent1 implements parentInterface
    } // parent1
    class parent2 implements parentInterface
    }  // parent2

  • How to get the class name  static method which exists in the parent class

    Hi,
    How to know the name of the class or reference to instance of the class with in the main/static method
    in the below example
    class AbstA
    public static void main(String[] args)
    System.out.println(getXXClass().getName());
    public class A extends AbstA
    public class B extends AbstA
    on compile all the class and run of
    java A
    should print A as the name
    java B
    should print B as the name
    Are there any suggestions to know the class name in the static method, which is in the parent class.
    Regards,
    Raja Nagendra Kumar

    Well, there's a hack you can use, but if you think you need it,Could you let me the hack solution for this..
    you probably have a design flaw and/or a misunderstanding about how to use Java.)May be, but my needs seems to be very genuine..of not repeat the main method contents in every inherited class..
    The need we have is this
    I have the test cases inheriting from common base class.
    When the main method of the test class is run, it is supposed to find all other test cases, which belong to same package and subpackages and create a entire suite and run the entire suite.
    In the above need of the logic we wrote in the main method could handle any class provided it knows what is the child class from which this main is called.
    I applicate your inputs on a better way to design without replicating the code..
    In my view getClass() should have been static as the instance it returns is one for all its instances of that class.
    I know there are complications the way compiler handles static vars and methods.. May be there is a need for OO principals to advance..
    Regards,
    Raja Nagendra Kumar
    Edited by: rajanag on Jul 26, 2009 6:03 PM

  • Can I insert the name poperty of the RequestedByUser related object of the parent Change Request workitem in a review activity email notification template?

    I am working on a SCSM change control workflow driven by email. 
    A lot of my work is based on the information found in this post:
    http://blogs.technet.com/b/servicemanager/archive/2012/04/03/using-data-properties-from-the-parent-work-items-in-activity-email-templates.aspx#pi158453=4
    This is an excellent post to which my Internet searches continually return. The workflow is about 90% complete. 
    My question is can I insert the properties of a related object of the parent workitem in a workflow email notification? 
    For example, I want to include the name property of the RequestedByUser related object of the parent workitem object in a review activity notification.

    Thank you for your reply.  I have confirmed my template is using a projection that includes the parent workitem and requested by user.  Where I am having trouble is the notification template syntax used to call the properties of the related
    object of the parent workitem.  The picker in the GUI won't show that related object, so I have no example to follow.  I hope this reply makes sense!

  • Get name of the folder after parent.

    Hi forum.
    I need a great help from you.
    If I could get the name of the folder which is between the Desktop and the indesign files where it ls saved...
    eg.
    /Users/wleastudio/Desktop/rantac/acb.indd.
    I need to get the folder name highlited in red and alert...
    if this is straight away on desktop i can do alert easily like below..
    name = Folder("/Users/wleastudio/Desktop/");
    if(app.activeDocument.filePath == name.path+"/" + name.name) {
        alert ("The document is in Desktop"), exit;
    if, the document is saved inside a folder on a desktop, that's the problem, i'm finding to difficult to find folder name and get alert..
    /Users/wleastudio/Desktop/rantac/acb.indd.
    Many thanks in advance

    Hi,
    Many many apologies for the delayed reponses...
    Your help support me a lot!!!.. but,
    try {
    if(app.activeDocument.filePath.parent.parent.parent.parent.parent.pare nt.name =="Desktop") {
        alert ("Correct Location " + app.activeDocument.filePath);
    else {
    alert("the Job is wrong Location"  +"\r" +"currently here it is" + app.activeDocument.filePath)
    }} catch (e) {}
    When the parent folder name is mentioned" the script catches and alerts.
    if the "indesign doc" is not in the parent folder. i.e. it may be inside the folder on the desktop or download folder of some other folder...
    The alert says"null folder" not found.
    Many thanks

  • Query to find the parent group name

    what is/are the table name that i should use to find the parent name of the job?
    thank you,
    warren

    Hi Warren,
    The parent group name (dbo.jobmst.jobmst_prntname) can be found within jobmst table.
    For example, the below query will return parent name of a specified job:
    SELECT dbo.jobmst.jobmst_prntname
    FROM dbo.jobmst
    WHERE dbo.jobmst.jobmst_name = 'Enter name of job here'
    BR,
    Derrick Au

  • Last Name within the Contact Parent actually reads "Task Name" when editing it

    I created a new contact type named New Hire for a workflow I am working on. The contact type was from existing group Core Contact and Calendar Columns. I noticed "Last Name" source is "Item" when all the other contact
    fields are "Contact". Then when I open it to change it from Optional to Required, the field actually shows "Task Name" for the Column Name. This is not right. Please let me know how to fix...
    How I got there…
    - Site Settings
    - Site Content Types
    - Created a new Contact Type named New Hire
    - Last Name is Item and not part of the type “Contact” like the others
    - And when I open up Last Name and Edit it, I see “Task Name"
    How can I fix this?

    Hi,
    Content types are organized into a hierarchy that allows one content type to inherit its characteristics from another content type. All SharePoint OOTB content type  inherits System content type. For detail, you can see that Item content type inherits
    System content type, Folder content type inherits Item content type, Document content type inherits Item content type and so on.
    Reference:
    https://support.office.microsoft.com/en-in/article/Introduction-to-content-types-and-content-type-publishing-a5026d23-8df8-42f6-b0d6-1920880c0d03?CorrelationId=d954de50-76c9-4003-81bb-49f3dfc68854&ui=en-US&rs=en-IN&ad=IN#__toc256601761
    As Contact content type inherits Item content type, Contact  content type inherit the Title column of Item content type. So Last Name is tied to Title.
    For your issue, Last Name should be the Title. Also you can create a separate Title field.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

Maybe you are looking for

  • Blue screen of death with windows seven

    Ok to begin, I understand that Im using a release candidate operating system but I would appreciate any help. When I'm watching a slow I get a blue screen of death. With the fallowing error details: Problem signature:   Problem Event Name: BlueScreen

  • Dv6-1216sa cpu upgrades?

    running win 7 32bit, (although will be upgradeing to 64bit soon) bios up to date F:18 current cpu: AMD Turion X2 RM-74 2.2GHz currently my ram is 4gb, which i can only use 3 of hence the upgrade to the 64 bit os soon i will be upgradeing to 8gb ram,

  • Cannot find the file MsDtsSrvr.ini.xml

    My SSIS 2008 book says that -  The MSDTSServer100 service is configured through an XML file that is located by default in the following path: C:\Program Files\Microsoft SQL Server\100\DTS\Binn\MsDtsSrvr.ini.xml.  I cannot find this file in the given

  • Wireless Webcam for Mac?

    Hi folks. I'm needing some webcams around the house, that tie into my wireless network. I don't need outdoor, nor steering/manipulation/sound. I just want to plug it in, point it at my bbq or front door, and sit at my computer to review 4 fps, or som

  • Exported nested sequence does not match previews

    I'm currently working on a project in which I've setup my main source video edits in to one master sequence. I have then nested this master sequence in to further sequences to be exported as highlight clips. When previewing the highlight clips within