Package com.swiftmq.swiftlet.scheduler
Interface JobFactory
public interface JobFactory
A JobFactory is registered at a JobGroup and creates Jobs. The name of the factory
should be the name of the Job, created from this factory. For example, a factory creating
'Queue Mover' jobs returns 'Queue Mover' as its name.
Before a Job is obtained from the factory with "getJobInstance", the job parameters are retrieved and verified. If that was ok, the Job is obtained from the factory via the "getJobInstance" method. After the Job has been finished, the method "finished" is called with the Job instance and eventually a JobException, thrown by the Job.
Due to this check-out (getJobInstance) and check-in (finished) behavior, a JobFactory can be implemented as a pool of Jobs with pre-created Job instances etc.
A JobFactory is accessed by a single thread at a time, so there is no need for synchronization.
Before a Job is obtained from the factory with "getJobInstance", the job parameters are retrieved and verified. If that was ok, the Job is obtained from the factory via the "getJobInstance" method. After the Job has been finished, the method "finished" is called with the Job instance and eventually a JobException, thrown by the Job.
Due to this check-out (getJobInstance) and check-in (finished) behavior, a JobFactory can be implemented as a pool of Jobs with pre-created Job instances etc.
A JobFactory is accessed by a single thread at a time, so there is no need for synchronization.
- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2003, All Rights Reserved
-
Method Summary
Modifier and TypeMethodDescriptionvoid
finished
(Job job, JobException exception) Marks a Job instance as finished.Returns a short description of the JobFactory, e.g.Returns a Job instance.getJobParameter
(String name) Returns a JobParameter with the given parameter name.Returns a Map of JobParameters, keyed by the parameter name or null if no parameter is defined.getName()
Returns the name of the JobFactory, e.g.
-
Method Details
-
getName
String getName()Returns the name of the JobFactory, e.g. 'Queue Mover'- Returns:
- Name
-
getDescription
String getDescription()Returns a short description of the JobFactory, e.g. 'Moves the content of a Queue'- Returns:
- description
-
getJobParameters
Map getJobParameters()Returns a Map of JobParameters, keyed by the parameter name or null if no parameter is defined.- Returns:
- Map of JobParameters
-
getJobParameter
Returns a JobParameter with the given parameter name.- Parameters:
name
- Parameter name- Returns:
- JobParameter or null
-
getJobInstance
Job getJobInstance()Returns a Job instance. This is equal to a check-out of a pool.- Returns:
- Job
-
finished
Marks a Job instance as finished. Called after the Job has been terminated. This is equal to a check-in into a pool.- Parameters:
job
- Job instanceexception
- JobException thrown by the Job instance
-