in the Person class I'm having a bunch of erroneous errors after my for loop in the
Fantastic news! We've Found the answer you've been seeking!
Question:
in the "Person" class I'm having a bunch of erroneous errors after my for loop in the code and I'm not sure why... Especially with the thread sleep syntax... That should at least be totally fine, but my IDE is yelling at me, (eclipse)... Heres the code for the person class.
Transcribed Image Text:
=398的例1及3 66 67 68 69 700 71 72 73 740 75 76 77 78 79 80 810 82 83 84 85 86 87 88 x89 X 90 91 x92 93 94 X95 96 X 97 98 99 100 101 ◄ } /** * @param args * @throws Interrupted Exception */ public static void main(String[] args) throws InterruptedException { Person person = new Person(); person.sendRequest("localhost", 8888, "Give me 2 apples"); simulateMulipleClients (person); } private static void simulateMulipleClients (Person person) throws Interrupted Exception { ExecutorService es= Executors.newCachedThreadPool(); String[] requests = new String[] { "Give me 2 apples", "Give me 2 bananas", }; Thread threads[] = new Thread[requests.length]; for (int i = 0; i { }); threads [i].start(); } } person.sendRequest("localhost", 9999, request); Thread, sleep(3000); System.out.println("Testing done."); // Send the final request to stop person.sendRequest("localhost", 9999, "stop."); Writable Smart Insert 18:4:360 178M of 259M =398的例1及3 66 67 68 69 700 71 72 73 740 75 76 77 78 79 80 810 82 83 84 85 86 87 88 x89 X 90 91 x92 93 94 X95 96 X 97 98 99 100 101 ◄ } /** * @param args * @throws Interrupted Exception */ public static void main(String[] args) throws InterruptedException { Person person = new Person(); person.sendRequest("localhost", 8888, "Give me 2 apples"); simulateMulipleClients (person); } private static void simulateMulipleClients (Person person) throws Interrupted Exception { ExecutorService es= Executors.newCachedThreadPool(); String[] requests = new String[] { "Give me 2 apples", "Give me 2 bananas", }; Thread threads[] = new Thread[requests.length]; for (int i = 0; i { }); threads [i].start(); } } person.sendRequest("localhost", 9999, request); Thread, sleep(3000); System.out.println("Testing done."); // Send the final request to stop person.sendRequest("localhost", 9999, "stop."); Writable Smart Insert 18:4:360 178M of 259M
Expert Answer:
Answer rating: 100% (QA)
It looks like there are a couple of issues in your code Here are some suggestions It seems like ther... View the full answer
Related Book For
A Concise Introduction to Logic
ISBN: 978-1305958098
13th edition
Authors: Patrick J. Hurley, Lori Watson
Posted Date:
Students also viewed these programming questions
-
Modify class Time2 of Fig. 8.5 to include a tick method that increments the time stored in a Time2 object by one second. Provide method incrementMinute to increment the minute by one and method...
-
Demonstrated the recursive merge sort algorithm. Reimplement the program of Fig. 19.6 using the Fork/Join Framework. Fig. 19.6 I // Fig. 19.6: MergeSortTest.java // Sorting an array with merge sort....
-
Data Corporation has four employees and provides group term life insurance coverage for all four employees. Coverage is nondiscriminatory and is as follows: a. How much may Data Corporation deduct...
-
Refer to the information in Exercise 18-21. Suppose MacLean Manufacturing Company uses the FIFO method of process costing instead of the weighted-average method. Exercise 18-21 Required: Compute...
-
Let D be the region bounded below by the cone z = x 2 + y 2 and above by the plane z = 1. Set up the triple integrals in spherical coordinates that give the volume of D using the following orders of...
-
Discuss the sampling strategy and technique to be used. Develop a hypothetical research scenario that would necessitate the use of the Action Research Approach and a Posttest With a Historical...
-
The Munchkin Theater is a nonprofit organization devoted to staging theater productions of plays for children in Toronto, Canada. The theater has a very small full-time professional administrative...
-
Write a three page paper on Compare and contrast Online Analytic Processing (OLAP) and Online Transaction Processing (OLTP); also discuss Codds rules for TP databases and OLAP databases. Cite any...
-
Glenn Dental Clinic provides general dental care to residents of Philadelphia on walk-in basis. The clinic has started receiving complaints from patients that the waiting time is too long and has...
-
Maggie Limited is owned 50% by Barb Limited and 50% by John Limited. Barb Limited and John Limited are 100% owned by Barb and John, respectively. Barb and John are married. Maggie Limited derives all...
-
Imagine you are a consultant, and you have been asked to assist Sensables's on their NPD strategic plans and Product Innovation Charter. What ideas would you suggest to them?
-
Entity C purchased two electric vehicle (EV) charging stations ($35,000 each) on January 1, 2024, for $70,000. They were originally depreciated on a straight-line basis over five years with no...
-
In the realm of file systems, how do advanced operating systems address issues related to data integrity, redundancy, and fault tolerance, incorporating concepts like journaling, RAID configurations,...
-
The company has entered into appropriate forward exchange contract to hedge .calculate the amount in kshs. that the company will receive.
-
Simplify the following radicals. 13) 375 14) 75 15) 81x5 16) 45x6y6 17) 192 8x5 18) 49x2 19) 64x18 20) 180 50x10y4 21) V-108 22) 23) 9x7y 24x12 27 24) 8y7
-
When the (Rx= Rdevice) in ohmmeter, so: |(A)I= Imax |(B) I= 0.5Imax |(C)I= 2Imax (D) I= 0.25Imax
-
Synthesize the products by drawing out reagents and intermediates along the way. `N H. OH HO HO
-
All advocates of school prayer are individuals who insist on imposing their views on others. Therefore, some advocates of school prayer are individuals who insist on imposing their views on others....
-
Every province in Canada has exactly one city as its capital. Therefore, since there are thirty provinces in Canada, there are thirty provincial capitals. The following arguments are deductive....
-
1. Either we require forced sterilization of Third World peoples or the world population will explode and all of us will die. We certainly don't want to die, so we must require forced sterilization....
-
Explain the error in this interpretation of inflation data: In the 12-month period ending in December of 1980, consumer prices rose by 12.4 percentafter a 13.3 percent increase the year before....
-
Answer this letter to Ann Landers: Ive read your column for ages and almost always agree with you. One subject on which we do not see eye-to-eye, however, is senior citizens driving. According to the...
-
Identify the error in Table 3.10, showing consumer prices and the change in prices based on a price index equal to 100 in 2000. Table 3.10 Year Price Index Change from Previous Year Change from 2000...
Study smarter with the SolutionInn App