This week's book giveaway is in the NodeJS forum. We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line! See this thread for details.
A monitor class containing the F array. The monitor class must have the following public methods, and no other public methods.
Constructor (int n). This constructor initializes the monitor to calculate the generalized Fibonacci number for argument n.
void putValue (int i, BigInteger value). This method puts the given value into array element i. It is an error if a value has already been put into array element i.
BigInteger getValue (int i). This method returns the value stored in array element i. This method does not return until array element i has been put.
A thread that prints the output.
A thread that computes one and only one array element and stores it in the monitor. There is a separate instance of this thread for each array element, including array elements 0 and 1.
A main program. The main program must create the above objects. The main program must start the threads in this order: first the output printing thread, then the thread that computes the last array element, then the thread that computes the next-to-last array element, and so on backwards through the array elements. The main program must not wait for the threads to terminat
1. you have synchronized the putValue and getValue of supercalss and implement this method in the different sublasses which are runnable also.but in actual whenever the 2 methods are implemented in subclass each time they create a new superclass instance and use them as lock.i.e.,you are not using the same lock
for doing your stuff each time you are calling the two methods they are using the lock associated with new super instance.
2. you have used wait,notifyAll in your class actually whenever you use the 2 methods make it sure that condition queue related with them is a same object along with the lock,they are using for checking condition predicate and for blocking wait and notify,should be the same.in your case the condition queue you are using for the wait and notify are different objects along with different lock being used their for the 3 things just mentioned.
try to nest the classes as static private member inside the "Fib" which you have extended prior and their inside instantiate the one variable of enclosing class(Fib) and use that instead of the super keyword.
if still you don't understand any part hit the reply button.
hope it will help!
Try to enjoy your work while doing it,it will Automatically convert in Hard Work...