For this Project 3 Threads milestone, your project must maintain the functionality from the Project 2 Search assignment using a custom-made conditional read/write lock to create a thread-safe inverted index and a custom-made work queue to manage worker threads.

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


Prerequisites

You must complete the following assignments before beginning to work on this one:

Untitled

Functionality

Your main method must be placed in a class named Driver and must process the following additional command-line arguments:

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>

Multithreaded Search

If multithreading is enabled, the search process from Project v2.1 Tests must be multithreaded as follows: