Hi ,
I have a code similar to this :
--------------------------------------------------
import java.io.*;
public class SomeClass {
public SomeClass() {
}
public static void main(
String str[]){
// get the directory name as a command line argument
String dirName = str[0];
String individualfileName ="";
// get an array of all the files in this directory
private File[] files = (new File(dirName)).listFiles();
int n = files.length;
//loop thru the filenames
for(int x=0 ;x < n ; x++)
{
individualfileName =
files[x].getAbsolutePath();
doParsing(individualfileName)
}//end of for
}
public void doParsing(String fileName){
//code to parse this file .....
}
---------------------------------------------
I want to make use of multithreading (Runnable interface) to do the 'doParsing()' method in separate parallel threads (because there are IO related issues in that method ).
But that would mean I have to call this method doParsing() from a run() method , and start the
thread using myThread.start() .
What I am not able to figure out , is how to start different threads with different parameters ..fileName , in this case .
Am I missing out on the fundamentals somewhere ..any help will be appreciated .
[This message has been edited by Nirvana C (edited October 23, 2001).]
[This message has been edited by Nirvana C (edited October 23, 2001).]
[This message has been edited by Nirvana C (edited October 23, 2001).]
[This message has been edited by Nirvana C (edited October 23, 2001).]