22 lines
441 B
Java
22 lines
441 B
Java
|
package exp12;
|
||
|
|
||
|
import exp12.TicketingSystem.TicketingSystem;
|
||
|
|
||
|
public class Person extends Thread{
|
||
|
|
||
|
@Override
|
||
|
public void run() {
|
||
|
while (true) {
|
||
|
try {
|
||
|
Thread.sleep(3);
|
||
|
} catch (InterruptedException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
|
||
|
if ( !TicketingSystem.buy(Thread.currentThread().getName())) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|