qualcuno mi può spiegare cosa succede in questa classe?grazie
vi prego è urgente...
devo scrivere una relazione..e spiegare queste due classi cosa fanno!please
package it.threads.stations;
public class FuelMan extends Thread {
private boolean running = false;
private boolean isWorking = false;
FuelStation fuelStation;
public FuelMan(FuelStation fs) {
running = true;
this.fuelStation = fs;
}
public boolean isWorking() {
return isWorking;
}
public void run() {
super.run();
while(running) {
try {
synchronized (this) {
this.wait();
//Svegliato
isWorking = true;
}
int wt = (int)(Math.random()*10) + 20; //Wait time
//System.out.println("WaitTime: "+wt);
Thread.sleep(wt);
fuelStation.returnKeysToDriver();
synchronized (this) {
isWorking = false;
}
} catch (InterruptedException e) {}
}
}
public void stopFuelMan() {
running = false;
}
}



