Results 1 to 2 of 2
  1. #1
    valery is offline Member
    Join Date
    Jul 2007
    Posts
    32
    Rep Power
    0

    Default identify a thread

    I want to identify my Thread, how can I do that?
    I know that in Java 5 you can do :"Thread.getId()" but I don't using java 5
    can you help me?
    Thanks

  2. #2
    shanePreater is offline Member
    Join Date
    Jul 2007
    Location
    England, Bath
    Posts
    47
    Rep Power
    0

    Default

    You could get the current name for the thread by doing:
    Java Code:
    Thread.getCurrentThread().getName();
    But it depends on what information you need to retrieve?
    Is it simply to tell you what thread is performing which task? In which case when you create the threads you can use the constructor with the additional String parameter and give it a meaningful name which you can then retrieve as above.

    If this is not your intended purpose please let me know what it is and I will try to elaborate for you.
    Last edited by shanePreater; 07-25-2007 at 02:25 PM. Reason: Speeling urrrr

Similar Threads

  1. data from the main/GUI thread to another runnin thread...
    By cornercuttin in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2008, 11:30 PM
  2. Replies: 0
    Last Post: 01-28-2008, 08:02 AM
  3. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 10:18 AM
  4. Replies: 1
    Last Post: 05-19-2007, 12:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •