Class HarvesterStatusReceiver
- java.lang.Object
-
- dk.netarkivet.harvester.distribute.HarvesterMessageHandler
-
- dk.netarkivet.harvester.scheduler.HarvesterStatusReceiver
-
- All Implemented Interfaces:
ComponentLifeCycle
,HarvesterMessageVisitor
,javax.jms.MessageListener
public class HarvesterStatusReceiver extends HarvesterMessageHandler implements ComponentLifeCycle
Handles the reception of status messages from the harvesters. Will call thevisit(HarvesterReadyMessage)
method when a Ready message is received.
-
-
Constructor Summary
Constructors Constructor Description HarvesterStatusReceiver(JobDispatcher jobDispatcher, JMSConnection jmsConnection, HarvestChannelDAO harvestChannelDao, HarvestChannelRegistry harvestChannelRegistry)
Constructor of theHarvesterStatusReceiver
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
shutdown()
The inverse of thestart()
method.void
start()
Implements functionality for starting an instances of thisComponentLifeCycle
object.void
visit(HarvesterReadyMessage message)
Tells the dispatcher that it may dispatch a new job.void
visit(HarvesterRegistrationRequest msg)
This method should be overridden and implemented by a sub class if message handling is wanted.
-
-
-
Constructor Detail
-
HarvesterStatusReceiver
public HarvesterStatusReceiver(JobDispatcher jobDispatcher, JMSConnection jmsConnection, HarvestChannelDAO harvestChannelDao, HarvestChannelRegistry harvestChannelRegistry)
Constructor of theHarvesterStatusReceiver
. This constructs also reads from settings, if we're limiting the number of submitted messages in each queue, and its limit. If the setting 'settings.harvester.scheduler.limitSubmittedJobsInQueue' is false, no limit is enforced, otherwise the limit is defined by setting 'settings.harvester.scheduler.submittedJobsInQueueLimit'.- Parameters:
jobDispatcher
- TheJobDispatcher
to delegate the dispatching of new jobs to, when a 'Ready for job' event is received.jmsConnection
- The JMS connection by whichHarvesterReadyMessage
is received.harvestChannelDao
- The specific HarvestChannelDAO instance to useharvestChannelRegistry
- The specific HarvestChannelRegistry instance to use
-
-
Method Detail
-
start
public void start()
Description copied from interface:ComponentLifeCycle
Implements functionality for starting an instances of thisComponentLifeCycle
object. This may be loading files, establish connections, initializing data, starting threads, etc.- Specified by:
start
in interfaceComponentLifeCycle
-
shutdown
public void shutdown()
Description copied from interface:ComponentLifeCycle
The inverse of thestart()
method. Contains functionality for deallocation of ressources, clearing data, closing connections, stopping threads, etc- Specified by:
shutdown
in interfaceComponentLifeCycle
-
visit
public void visit(HarvesterReadyMessage message)
Tells the dispatcher that it may dispatch a new job.- Specified by:
visit
in interfaceHarvesterMessageVisitor
- Overrides:
visit
in classHarvesterMessageHandler
- Parameters:
message
- The message containing the relevant harvester information.
-
visit
public void visit(HarvesterRegistrationRequest msg)
Description copied from class:HarvesterMessageHandler
This method should be overridden and implemented by a sub class if message handling is wanted.- Specified by:
visit
in interfaceHarvesterMessageVisitor
- Overrides:
visit
in classHarvesterMessageHandler
- Parameters:
msg
- aHarvesterRegistrationRequest
-
-