For this Project 3 Threads milestone, your project must maintain the functionality from the Project v3.0 Tests assignment, as well as support multithreaded building of the thread-safe inverted index using the same custom-made work queue from the Project v3.0 Tests assignment.
To do this, you should either create new classes or extend existing classes to support multithreading. DO NOT REMOVE YOUR SINGLE THREADING CODE, as you still need to support single threaded building and searching the index.
<aside>
<img src="/icons/error_gray.svg" alt="/icons/error_gray.svg" width="40px" /> Do NOT use any of the classes in the java.util.concurrent
package and do NOT use the Stream.parallel
method for the multithreaded code.
</aside>
TABLE OF CONTENTS
You must complete the following assignments before beginning to work on this one:
Your main
method must be placed in a class named Driver
and must process the following additional command-line arguments:
-threads [num]
where this flag/value pair works as before, but now also enables both multithreaded build and search. See the “Multithreaded Build” section below for details.These are in addition to the command-line arguments from the previous Project 2 Search assignment.
The command-line flag/value pairs may be provided in any order or not at all. Do not convert paths to absolute form when processing command-line input!
Output user-friendly error messages in the case of exceptions or invalid input. Under no circumstance should your main()
method output a stack trace to the user!
<aside>
<img src="/icons/warning_gray.svg" alt="/icons/warning_gray.svg" width="40px" /> If the -threads
flag is not provided, then multithreading should not be enabled. A thread-safe inverted index should not be initialized, a work queue should not be initialized, and no worker threads should be created. Your main
method should behave the same as previous projects.
</aside>
If multithreading is enabled, the build process from Project 1 Index must be multithreaded as follows: