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

Similar Messages

  • How can i figure out the answers to my security questions if i forgot the answers

    how can i figure out the answers to my security questions if i forgot the answers

    Welcome to the Apple Community.
    Start here, and reset your password, you will receive an email with your new password, then go tomanage your account > Password and Security and change your security questions.
    If that doesn't help you might try contacting Apple through iTunes Store Support

  • HT201320 How can you figure out the password for college email providers?

    I'm trying to configure my mail account. I want to use my college email but I don't know the provider password. How can I find that out?

    IT = Information Technology

  • HT1212 I forgot my password for my phone and it won't let me restore from an earlier date because its saying its locked. How can I figure out the forgotten password?

    Please help...
    I can't get in my phone and this is sooo frustratingt

    The only way to get passed it is by entering the correct passcode. If you are unable to the you need to follow how to restore via recovery with the article you referenced. Once you restore to factory settings you will then be able to restore from back up.

  • I sent my iphone in for replacement how can i figure out the tracking number?

    Also, how many days does it take?
    It's been three so far.

    go into this page:    https://selfsolve.apple.com/repairstatus/main.do
    follow the prompts

  • How can i figure out the apple id my ipod touch is associated with?

    I dont know what aple id is associated with my ipod touch 4g. i used so many accounts to dowload apps and now when i used one to download music, i have to wait 90 days. and this happened before and i had to wait. But i dont know wich apple id i used for this to happen. can someone please help me out

    settings->itunes & app store the appleID is listed
    same with settings->iCloud

  • How can i figure out the beats per minute of all the songs on my itunes list?

    I am a runner and would like to know the beats per minute of each song on my playlist.  Is there any app that is compatible with itunes so that I could get this information and easily upload it?

    The mentioned BeaTunes is nice... I've also used Tangerine.  You'll find that scanning one song with one app and scanning the same song with a different app will produce different results.  I'd just recommend being consistent and using the same app once you'd played with them to determine your favorite.
    Mixmeister also has a few different levels of software for DJ type stuff.

  • How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How about a few specific NOUNs to replace the vague references you have made. A little context.
    Volumes of WHAT ?
    What sort of STUFF are you trying to eliminate ?

  • I see "imac-54f9d5" under the "Shared" heading in my finder. I am not connected to any printers or other Mac devices. Is it possible that someone is remotely accessing my system? How can I figure out what this is?

    I see "imac-54f9d5" under the "Shared" heading in my finder. I am not connected to any printers or other Mac devices. Is it possible that someone is remotely accessing my system? How can I figure out what this is?

    is it your imac?
    is it your your router's name?
    are you by any chance connected to another wifi router then your own because the other one was open and not password protected?

  • How can i figure out from my account page which kids ipad made purchases

    How can I figure out which childs ipad made an in app purchase from my main account - recent purchases page?

    As far as I know there isn't any way to see which device made the purchase

  • How can i find out the table hierarchy

    Hi experts,
    I have one doubt. how can i find out the table hierarchy in the particular schema.
    Let me explain my requirement in detail.. In my Database i have nearly 250 table each table have it's own temporary table(for authorization purpose we are maintaining the temporary tables) for each day i have to clear the temporary table data.
    All temporary table connected with each other. i mean all the table having foreign key relationship.. while i attempt the delete the data from the temporary table it showed ORA-02292: integrity constraint  violated - child record found.
    So can any one please tell how can i delete the child table record first and then parent record table record.
    Thanks in advance
    Arun

    CREATE OR REPLACE FUNCTION get_child_tables (
    ptable VARCHAR2,
    powner VARCHAR2 DEFAULT 'SCOTT',
    plevel NUMBER DEFAULT 10
    RETURN stringarray
    -- -- create this ON SQL*PLUS "CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);"
    -- AUTHID CURRENT_USER
    PIPELINED
    AUTHOR DATE VERSION COMMENTS
    ======================================================================================
    [email protected] 26-OCT-2009 1.0 Developed to ease developers effort to find Nth level of Referential integrity
    ======================================================================================
    -- PURPOSE -> To find PARENT=> CHILD relational TABLE(S) in Oracle upto a depth max N Level.
    --SYNTAX TO USE
    SELECT * FROM TABLE( get_child_tables('DEPT','SCOTT',3)); Store this query in a file for your use
    SELECT * FROM TABLE( get_child_tables('EMPLOYEE')); Store this query in a file for your use
    -- RESULTS looks as below
    --1 => DEPT
    --2 => EMP
    --2 => EMP2
    --3 => EMP_CHILD
    --3 => EMP2_CHILD
    -- and so on
    --This can be leveraged to use in any oracle database REGION 10g having and above.
    --This FUNCTION gives formatted result of the Oracle 10g Hierarchical query result coded in the cursor
    --to find MASTER => CHILD relational TABLE(S) upto a depth max 10 Level.
    --The result of the PIPELINED function can be retrieved using Oracle new operator
    --TABLE(array name) in SQL query.
    --Due to the AUTHID CURRENT_USER compiler directive any user can use based on his/her access privileges on the database.
    --GRANT EXECUTE ON SCOTT.get_child_tables TO PUBLIC;
    --CREATE OR REPLACE PUBLIC SYNONYM get_child_tables FOR SCOTT.get_child_tables;
    IS
    atname stringarray := stringarray ();
    -- create this ON SQL*PLUS CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);
    vlevel NUMBER;
    vtname VARCHAR2 (50);
    nindex NUMBER := 0;
    bprocessed BOOLEAN := FALSE;
    CURSOR c1 (powner_in IN VARCHAR2, ptable_in VARCHAR2, plevel_in NUMBER)
    IS
    SELECT LEVEL, LPAD (' ', (LEVEL - 1) * 2, ' ') || pt AS "TNAME"
    FROM (SELECT a.owner w1, a.table_name pt, a.constraint_name c1,
    a.r_constraint_name r1, b.owner w2, b.table_name ct,
    b.constraint_name c2, b.r_constraint_name r2
    FROM all_constraints a, all_constraints b
    WHERE a.constraint_name = b.r_constraint_name(+)
    AND a.owner = b.owner(+)
    AND a.owner =
    UPPER (powner)
    -- Change Owner here while testing
    --AND A.r_constraint_name IS NULL
    AND a.constraint_type IN ('P', 'R')) v1
    START WITH pt =
    UPPER
    (ptable)
    -- Change your master table here while testing the QUERY
    CONNECT BY PRIOR ct = pt AND LEVEL <= plevel;
    -- Change lavel here while testing
    BEGIN
    atname.EXTEND;
    atname (1) := 'NOTHING';
    OPEN c1 (powner, ptable, plevel);
    LOOP
    bprocessed := FALSE;
    FETCH c1
    INTO vlevel, vtname;
    IF nindex > 1 AND atname (atname.LAST - 1) = vtname
    THEN
    --DBMS_OUTPUT.PUT_LINE('2 ==== vtname  ' ||vtname || '   '|| atname.count|| '   '||atname.last ||  '   '||atname( atname.last-1));
    bprocessed := TRUE;
    END IF;
    IF NOT bprocessed
    THEN
    nindex := nindex + 1;
    atname.EXTEND;
    atname (nindex) := vtname;
    PIPE ROW (vlevel || ' => ' || vtname);
    DBMS_OUTPUT.put_line ( ' **** nindex - atname( nindex) '
    || nindex
    || ' - '
    || atname (nindex)
    DLOG('ADDING ',vTname); A LOGGING ATONOMUS PROCEDURE FOR DEBUG PURPOSE
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    CLOSE c1;
    FOR i IN 1 .. atname.COUNT
    LOOP
    DBMS_OUTPUT.PUT_LINE('atname (i) ' ||atname (i));
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN no_data_needed
    THEN -- THIS EXCEPTION HAS TO BE THERE TO GET THE FUCTION WORKABLE
    DBMS_OUTPUT.put_line (SQLERRM);
    RETURN;
    --SELECT * FROM TABLE( get_child_tables('TB_XOP_LETR_TEMPLATE','OPS$CMS',5));
    END get_child_tables;
    Edited by: user3066657 on Jul 21, 2011 8:42 AM
    Edited by: user3066657 on Jul 21, 2011 11:26 AM

  • How can I figure out if my bmp has Nvidia graphics

    How can I figure out if my bmp has the Nvidia graphics ?

    Does the label on the original retail carton spell out the detail further?
    Depending on the build model year and other identifier, more information
    may be obtained, even by use of serial number or model number online.
    Some private sites that may or may not be secure, are available; some
    may show varying degrees of the build information and specification...
    And there is this Support article from Apple:
    •How to identify MacBook Pro models - Apple Support
    Looks to be a newer model with Retina display, and Iris graphics.
    Good luck & happy computing!

  • How can i figure out my security question answers

    how can i figure out my security questions answers

    The Three Best Alternatives for Security Questions and Rescue Mail
         1.  Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
         2.  Call Apple Support in your country: Customer Service: Contact Apple support.
         3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • HT1688 how can i figure out a passcode on my cellphone?

    how can i figure out a passcode that was put on my phone, person locked me out of my phone

    You probably can't figure it out.
    You will need to restore the iphone

  • I have an IPad with a Restriction code that we cannot remember.  Is it possible to delete and restore the IPad without the code?  If not how do I figure out the code or how t? o remove it?

    I have an IPad with a Restriction code that we cannot remember.  Is it possible to delete and restore the IPad without the code.  If not how do I figure out the code or how to remove it?

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

Maybe you are looking for