@DisallowConcurrentExecution
@PersistJobDataAfterExecution
public class DirectoryScanJob
extends java.lang.Object
implements org.quartz.Job
DirectoryScanListener that can be found in the
SchedulerContext.DirectoryScanListener,
SchedulerContext| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DIRECTORY_NAME
JobDataMap key with which to specify the directory to be
monitored - an absolute path is recommended. |
static java.lang.String |
DIRECTORY_SCAN_LISTENER_NAME
JobDataMap key with which to specify the
DirectoryScanListener to be
notified when the directory contents change. |
static java.lang.String |
MINIMUM_UPDATE_AGE
JobDataMap key with which to specify a long
value that represents the minimum number of milliseconds that must have
past since the file's last modified time in order to consider the file
new/altered. |
| Constructor and Description |
|---|
DirectoryScanJob() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(org.quartz.JobExecutionContext context) |
protected java.io.File[] |
getUpdatedOrNewFiles(java.lang.String dirName,
long lastDate,
long maxAgeDate) |
public static final java.lang.String DIRECTORY_NAME
JobDataMap key with which to specify the directory to be
monitored - an absolute path is recommended.public static final java.lang.String DIRECTORY_SCAN_LISTENER_NAME
JobDataMap key with which to specify the
DirectoryScanListener to be
notified when the directory contents change.public static final java.lang.String MINIMUM_UPDATE_AGE
JobDataMap key with which to specify a long
value that represents the minimum number of milliseconds that must have
past since the file's last modified time in order to consider the file
new/altered. This is necessary because another process may still be
in the middle of writing to the file when the scan occurs, and the
file may therefore not yet be ready for processing.
If this parameter is not specified, a default value of
5000 (five seconds) will be used.
public void execute(org.quartz.JobExecutionContext context)
throws org.quartz.JobExecutionException
execute in interface org.quartz.Joborg.quartz.JobExecutionExceptionJob.execute(org.quartz.JobExecutionContext)protected java.io.File[] getUpdatedOrNewFiles(java.lang.String dirName,
long lastDate,
long maxAgeDate)