public class FaultyHarvestControllerServer extends HarvesterMessageHandler implements CleanupIF
Initially, it registers its channel with the Scheduler by sending a HarvesterRegistrationRequest and waits for a positive HarvesterRegistrationResponse that its channel is recognized. If not recognized by the Scheduler, the HarvestControllerServer will send a notification about this, and then close down the application. During its operation CrawlStatus messages are sent to the HarvestSchedulerMonitorServer. When responding to the message, it sends a message with status 'STARTED'. When 10 minutes have passed, a message is sent with status 'FAILED'.
Before the 10 minutes starts, the JMS listener is removed to avoid handling more than one doOneCrawlMessage at a time During the 10 minutes, it will send two (instead of one) HarvesterReadyMessages to the scheduler to test issue NAS-2614. The interval between sending HarvesterReadyMessages is defined by the setting 'settings.harvester.harvesting.sendReadyDelay'.
Modifier and Type | Field and Description |
---|---|
static ChannelID |
HARVEST_CHAN_VALID_RESP_ID
The JMS channel on which to listen for
HarvesterRegistrationResponse s. |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Will be called on shutdown.
|
void |
close()
Release all jms connections.
|
static FaultyHarvestControllerServer |
getInstance()
Returns or creates the unique instance of this singleton.
|
void |
sendErrorMessage(long jobID,
String message,
String detailedMessage)
Sends a CrawlStatusMessage for a failed job with the given short message and detailed message.
|
void |
visit(DoOneCrawlMessage msg)
Here we receives a DoOneCrawlMessage, waits 10 minutes, and then fails the job.
|
void |
visit(HarvesterRegistrationResponse msg)
This method should be overridden and implemented by a sub class if message handling is wanted.
|
public static final ChannelID HARVEST_CHAN_VALID_RESP_ID
HarvesterRegistrationResponse
s.public static FaultyHarvestControllerServer getInstance() throws IOFailure
PermissionDenied
- If the serverdir or oldjobsdir can't be createdIOFailure
- if data from old harvests exist, but contain illegal datapublic void close()
public void cleanup()
cleanup
in interface CleanupIF
CleanupIF.cleanup()
public void visit(HarvesterRegistrationResponse msg)
HarvesterMessageHandler
visit
in interface HarvesterMessageVisitor
visit
in class HarvesterMessageHandler
msg
- a HarvesterRegistrationResponse
public void visit(DoOneCrawlMessage msg) throws IOFailure, UnknownID, ArgumentNotValid, PermissionDenied
visit
in interface HarvesterMessageVisitor
visit
in class HarvesterMessageHandler
msg
- The crawl jobIOFailure
- On trouble harvesting, uploading or processing harvestInfoUnknownID
- if jobID is null in the messageArgumentNotValid
- if the status of the job is not valid - must be SUBMITTEDPermissionDenied
- if the crawldir can't be createdfor more details
public void sendErrorMessage(long jobID, String message, String detailedMessage)
jobID
- ID of the job that failedmessage
- A short message indicating what went wrongdetailedMessage
- A more detailed message detailing why it went wrong.Copyright © 2005–2018 The Royal Danish Library, the National Library of France and the Austrian National Library.. All rights reserved.