Java classes from | Computer Science homework help

In the first part, you will complete a partially-implemented web crawler program. In the second,

you will use Java classes from the package java.util.concurrent to divide the workload

among multiple threads of control. 


Download the starting code in this zip file. Inside the src directory are two

subdirectories: spider contains the (partially complete) sequential web crawler for use with Part

1, and concurrentSpider contains the threaded web crawler code for use with Part 2.  This code

uses classes from the Java class library for parsing HTML files and pulling out links

(java.net.url among others).

Part 1 – Sequential Web Crawler.

1. In this part, you will complete a program that is able to “crawl the web” starting from a

given URL. A detailed problem specification and descriptions of the provided classes can

be found in the first section of Concurrent Data Structures in Java. Complete the tasks

given in the To Do sections and the Try This section.

2.

3. The finished program should output the URLs it processes as it crawls the website.

Capture this output in a file.

4.

5. There will be a check-in date to make sure nobody is waiting until the last minute to

complete this part. I will ask for copy of your Spider.java file to ensure everyone is

making progress.

Part 2 – Multi-threaded Web Crawler.

1. Production-quality web crawlers divide the work of following links from multiple web

pages among multiple versions of themselves, using a Java (and operating system)

concept called threads (you used threads in CSci 157 whenever you

programed ActiveObjects). Each thread must share the data structures being used,

which can cause problems if (for example) two instances try to remove from the work

queue at the same time. Because our Queue implementations are not thread-safe, they

cannot be used in this version. Instead, we can use implementations provided by the Java

package java.util.concurrent. Unfortunately the interface these classes

implement is different from the QueueInterface. For example, the method add is

used instead of enqueue, and peek or poll instead of dequeue.  


 

2. A detailed problem specification can be found in the second section of Concurrent Data

Structures in Java. An outline of the concurrent solution and the problems that concurrent

data structures solve can be found in the third section. 

 

3. Complete the tasks given in the To Do sections and the Try This section of section two.

Deliverables

For this project you will turn in:

• a README file for each part, containing SHORT instructions on how to compile and run

each program and a description of any issues or known bugs. You do not need to describe

the program itself.

• all Java files required to build and run the program(s), using the same file structure as the

provided zip file

These files are to be turned in as follows: zipped into a single archive file, emailed to me.

Do not include binary files (such as .class files); sometimes Gmail flags those as malware and

won’t send them.

"Get 15% discount on your first 3 orders with us"
Use the following coupon
"FIRST15"

Order Now