Java Reference
In-Depth Information
C
HAPTER
15: U
SING
AN
SQL W
ORKLOAD
• Dealing with Broken Connections
• Using PreparedStatements
• Creating Hash Codes for URLs
• Working with Multiple Hosts
The Heaton Research Spider includes an SQL based workload manager. The SQL work-
load manager allows the Heaton Research Spider to store its lists of URLs to a JDBC SQL
database. This allows the spider to manage a very large set of URLs. This chapter will discuss
the internals of how the
SQLWorkloadManager
class was implemented.
If you are only interested in using the
SQLWorkloadManager
, you should refer to
Chapter 13. Chapter 13 contains a complete description of how to use the Heaton Research
Spider. Chapter 14 shows you how the Heaton Research Spider itself was constructed. This
chapter focuses exclusively on how the
SQLWorkloadManager
class was construct-
ed.
There are three different classes that make up the SQL workload manager. All three of
these classes are in the following package:
com.heatonresearch.httprecipes.spider.workload.sql
The classes contained in the above package are listed here:
• RepeatableStatement
• SQLWorkloadManager
• Status
The
RepeatableStatement
holds an SQL statement that can be repeated if the
connection to the database is broken. The
SQLWorkloadManager
is the main class for
the SQL workload manager. The
Status
class is just a simple data holder which is used
to hold the status of each URL in the workload. The
RepeatableStatement
and
SQLWorkloadManager
classes will be discussed in the next sections.