This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
PF3/hw1/Ex5/src/main/java/reentrantrwlock/Movie.java

27 lines
487 B
Java

package reentrantrwlock;
public class Movie {
private final String title;
private final int duration;
public Movie(String title, int duration) {
this.title = title;
this.duration = duration;
}
public String getTitle() {
return title;
}
public int getDuration() {
return duration;
}
public void play() throws Exception {
Thread.sleep(duration);
System.out.println("[" + Thread.currentThread().getName()
+ "]: I've finished watching movie: " + title);
}
}