Waiting for a thread
Hi,
i have a problem with threads...
in my "main" programm there is a method, that starts other methods...
In one method there are started two new threads, whitch copys the data from one DBMS to another. Now the main- programm should wait untill the threads have finished copying.
publicvoid steuerung(){
filedescription();
while (erzTab||erzDaten||erzInd||erzView){
if (erzTab)
createTable();
elseif (erzDaten&&alleDaten&&direkt)
datenAllDirekt();//==>starts two threads
//now i want to wait.....
elseif (erzDaten&&!alleDaten&&direkt)
datenTeilDirekt();
elseif (erzDaten&&!direkt)
datenDatei();
elseif (erzInd)
createIndex();
elseif (erzView)
createView();
}
return;
}
The method datenAllDirekt looks like following...
publicvoid datenAllDirekt(){
dataRead reader =new dataRead (DBread,con_as400,logfile,tempPfad);
reader.start();
daaWrite write =new dataWrite(DBwrite, con_MSsql, logfile, tempPfad, reader);
write.start();
I have insert the following code at "//now i want to wait"
try{
wait();
}catch (InterruptedException ex){
}
But then an "IllegalMonitorStateException: current thread not owner" occures.
How can I solve my problem?
Thanks for help....

