hai ragione:
Questa è la prima classe chi creo
threadPadre tp = new threadPadre();
tp.start()
poi dentro questa classe creo la seconda classe(thread) scansione Sito
codice:
//------------------------ INIZIO THREAD PADRE -----------------------//
class threadPadre extends Thread {
public void run() {
inizio();
}
synchronized void inizio(){
for(;;) {
scansioneSito t1 = new scansioneSito();
t1.start();
try {
wait();
System.out.println("Dopo wait");
}
catch (InterruptedException e) {
System.out.println("DENTRO CATCH");
}
System.out.println("cont = cont + 1");
cont = cont + 1;
if (fine == true) {
break;
}
System.out.println("Dopo if");
}
}
}
//------------------------ FINE THREAD PADRE -----------------------//
//------------------------- INIZIO SCANSIONE SITO -------------------//
class scansioneSito extends Thread {
String sito, codice;
public void run() {
inizio();
}
synchronized void inizio(){
sito = (String) arrSiti.elementAt(cont);
System.out.println("SITO: " + sito);
codiceHtml ist = new codiceHtml();
codice = ist.trova(sito);
if (codice == "-1") {
System.out.println("ERRORE: Dentro classe thread, url non valido");
System.out.println("FINE THREAD STO PER INVIARE IL NOTIFY");
notify();
}
else {
// analizzaTesto at = new analizzaTesto();
// at.analizza(codice, );
}
// for(;;) {
// }
System.out.println("FINE THREAD STO PER INVIARE IL NOTIFY");
notify();
}
}
//------------------------- FINE SCANSIONE SITO -------------------//
help