how to spawn a java program to reduce the running time
<p>I have a java program to read a input file (input.txt) and print the  content of that file (after that i need to do some more work there i.e ssh to a machine and check status,send email etc..). Since the input.txt file is having more lines it takes around 3hrs to complete the program.</p>

<p>So like to use spawn concept in java (like thread) or some other technique to spilt the process while reading the input file and do the other work (ssh,checkstatus,send mail) in the same time sothat the  program willl take hardly ten mintues to finish the program.</p>

<p>I am newbie to Java. Could you please guide me how to put that logic. I have pasted the code here which I have right now.</p>

<p>Example of input.txt file:</p>

<blockquote>
  #

<pre><code>    ABC
</code></pre>
  
  #
  
  <p>bigboy           72.24.1       72.24.157.57<br>
  bejack           2.24.157.97   1.24.157.69
  boni             2.24.147.96   9.24.159.86
  irony            7.24.145.93   8.24.209.55</p>
  
  #

<pre><code>   xyz
</code></pre>
  
  #
  
  <p>alches            2.24.140.199  1.24.140.46</p>
</blockquote>

<p>Java program: </p>

<pre><code>import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.util.Calendar;
import java.net.*;
import java.net.UnknownHostException;


public class panic_email{
    public static void main(String[] args) throws IOException{
    try{
        System.out.println ("Starting of program...");

        FileInputStream fstream = new FileInputStream("input.txt");
        DataInputStream input = new DataInputStream(fstream);
        BufferedReader bfr = new BufferedReader(new InputStreamReader(input));
        String Name = "";
        String IP = "";

        CSLOOP: while ((FileLine = bfr.readLine()) != null)   {
        FileLine = FileLine.trim();
        if ( FileLine.startsWith("XYZ") ){
                System.out.println ("End of program");
                break;
        }
        if ( !FileLine.startsWith("#") &amp;&amp; !FileLine.startsWith(" ") ){
          String splitLine[] = null;
          splitLine = FileLine.split("\\s+");
          if( splitLine.length &gt;= 3){
          Name = splitLine[0];
          Ip = splitLine[2];
System.out.println("Name:" + Name + "IP" + Ip); 
//Here after this I am doing some kind of extra work like ssh,checkstate,send email. So while coming to this point I need to spawn the process i think. 
         }
         }

 }

}
</code></pre>

<p>Could you please guide me how to do this</p>

<p>Thanks,
Ricks</p>
