ConditionDemo: removed final keyword not to confuse students
This commit is contained in:
@@ -5,10 +5,10 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Consumer extends Thread {
|
||||
private final Set knownObjects = new HashSet();
|
||||
private Set knownObjects = new HashSet();
|
||||
private int total = 0;
|
||||
private int unique = 0;
|
||||
private final SharedFiFoQueue queue;
|
||||
private SharedFiFoQueue queue;
|
||||
|
||||
public Consumer(SharedFiFoQueue queue) {
|
||||
this.queue = queue;
|
||||
|
||||
@@ -8,8 +8,8 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Producer extends Thread {
|
||||
private final static String FILENAME = "input.txt";
|
||||
private final SharedFiFoQueue queue;
|
||||
private static String FILENAME = "input.txt";
|
||||
private SharedFiFoQueue queue;
|
||||
|
||||
public Producer(SharedFiFoQueue queue) {
|
||||
this.queue = queue;
|
||||
|
||||
@@ -10,9 +10,9 @@ public class SharedFiFoQueue {
|
||||
private int PosW = 0;
|
||||
private int PosR = 0;
|
||||
|
||||
private final Lock lock = new ReentrantLock();
|
||||
private final Condition isEmpty = lock.newCondition();
|
||||
private final Condition isFull = lock.newCondition();
|
||||
private Lock lock = new ReentrantLock();
|
||||
private Condition isEmpty = lock.newCondition();
|
||||
private Condition isFull = lock.newCondition();
|
||||
|
||||
public SharedFiFoQueue(int capacity) {
|
||||
this.elems = new Object[capacity];
|
||||
|
||||
Reference in New Issue
Block a user