Question: Please answer in java Concurrency 18.12 Create JUnit test cases to verify that the synchronized keywords are needed on the set () and sort O

Please answer in java
 Please answer in java Concurrency 18.12 Create JUnit test cases to

Concurrency 18.12 Create JUnit test cases to verify that the synchronized keywords are needed on the set () and sort O methods of the DynamicArray example (Program 18.3). To test the set () method, you can create one thread that repeatedly sets, gets, and tests a changing value at a fixed location (eg, 0) and another thread that continuously appends to the array (causing it to grow by copy and replace, thus occasionally overwriting the value at the fixed location). To test the sort () method, create two threads that sort the same large random array at the same time. Check to see if the array is, in fact, actually sorted after the threads have exited. For both tests, you may need to repeat the operations a number of times to trigger the race condition Concurrency 18.12 Create JUnit test cases to verify that the synchronized keywords are needed on the set () and sort O methods of the DynamicArray example (Program 18.3). To test the set () method, you can create one thread that repeatedly sets, gets, and tests a changing value at a fixed location (eg, 0) and another thread that continuously appends to the array (causing it to grow by copy and replace, thus occasionally overwriting the value at the fixed location). To test the sort () method, create two threads that sort the same large random array at the same time. Check to see if the array is, in fact, actually sorted after the threads have exited. For both tests, you may need to repeat the operations a number of times to trigger the race condition

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!