Whether using Threads join correctly or not
<p><strong>I Want to execute a Certain Task to take only 1000 MS , if it exceeds , i dont want to continue with the task ,
i have used join for this .</strong></p>

<p>Please tell me and guide me if this is correct or not </p>

<pre><code>import java.util.List;

public class MainThread {

    public static void main(String args[]) throws InterruptedException {
        Thread mainthread = Thread.currentThread();
        ChildThread child = new ChildThread();
        Thread childThread = new Thread(child);
        childThread.start();

        mainthread.join(1000);
        List list = child.getData();

        if(list.size()&lt;0)

        {
            System.out.println("No Data Found");
        }
    }
}
</code></pre>

<p><strong>ChildTHread</strong></p>

<pre><code>import java.util.ArrayList;
import java.util.List;

public class ChildThread implements Runnable

{

    List list = new ArrayList();

    public List getData() {
        return list;
    }

    public void run() {
        // This List Data is feteched from Database currently i used some static data
        list.add("one");
        list.add("one2");
        list.add("one3");

    }
}
</code></pre>
