Results 1 to 2 of 2
  1. #1
    cucucur is offline Member
    Join Date
    Apr 2011
    Posts
    20
    Rep Power
    0

    Default call a thread knowing its ID

    hello, is it possible call a thread using its ID ???

    Java Code:
            static long ID;
    	public transmisor(Socket Conexion){
    		this.conexion=Conexion;
    	         ID = this.getId();
    	}
    	
    	public void run(){
    		while(true){
    			try{
    				java.util.Scanner in = new java.util.Scanner(System.in);
    				String enviar = in.nextLine();
    				
    				OutputStream bufferSalida = conexion.getOutputStream();  
    				DataOutputStream datos = new DataOutputStream(bufferSalida);
    				datos.writeUTF(enviar);
    			} catch (Exception e){
    				e.printStackTrace();
    			}
    		}
    	}
    Can I access I do something similar to:

    Java Code:
    thread(ID).run();
    Thank you in advance

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    Are you assuming that the thread has not started executing yet? Otherwise its execution can be anywhere.

Similar Threads

  1. Knowing what object called the actionListener?
    By enerj in forum New To Java
    Replies: 4
    Last Post: 11-02-2010, 09:30 AM
  2. Problem in knowing the status of windows
    By sushil in forum Advanced Java
    Replies: 1
    Last Post: 10-05-2009, 09:35 PM
  3. Need help in knowing how to clear buffer.
    By tedstevens in forum New To Java
    Replies: 1
    Last Post: 08-20-2009, 05:02 AM
  4. Knowing which IP address is active
    By sukatoa in forum Networking
    Replies: 2
    Last Post: 05-05-2009, 04:01 PM
  5. Replies: 0
    Last Post: 01-28-2008, 07:02 AM

Posting Permissions

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