fix bug in initial startup

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@424318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-07-21 13:48:28 +00:00
parent 57bf8e097a
commit 6fe39949df
1 changed files with 22 additions and 16 deletions

View File

@ -96,24 +96,31 @@ public class DefaultRepositoryTaskScheduler
private void scheduleJobs( Configuration configuration ) private void scheduleJobs( Configuration configuration )
throws ParseException, SchedulerException throws ParseException, SchedulerException
{ {
JobDetail jobDetail = new JobDetail( INDEXER_JOB, DISCOVERER_GROUP, RepositoryTaskJob.class ); if ( configuration.getIndexPath() != null )
JobDataMap dataMap = new JobDataMap();
dataMap.put( AbstractJob.LOGGER, getLogger() );
dataMap.put( RepositoryTaskJob.TASK_KEY, indexerTask );
jobDetail.setJobDataMap( dataMap );
getLogger().info( "Scheduling indexer: " + configuration.getIndexerCronExpression() );
CronTrigger trigger =
new CronTrigger( INDEXER_JOB + "Trigger", DISCOVERER_GROUP, configuration.getIndexerCronExpression() );
scheduler.scheduleJob( jobDetail, trigger );
try
{ {
indexerTask.executeNowIfNeeded(); JobDetail jobDetail = new JobDetail( INDEXER_JOB, DISCOVERER_GROUP, RepositoryTaskJob.class );
JobDataMap dataMap = new JobDataMap();
dataMap.put( AbstractJob.LOGGER, getLogger() );
dataMap.put( RepositoryTaskJob.TASK_KEY, indexerTask );
jobDetail.setJobDataMap( dataMap );
getLogger().info( "Scheduling indexer: " + configuration.getIndexerCronExpression() );
CronTrigger trigger =
new CronTrigger( INDEXER_JOB + "Trigger", DISCOVERER_GROUP, configuration.getIndexerCronExpression() );
scheduler.scheduleJob( jobDetail, trigger );
try
{
indexerTask.executeNowIfNeeded();
}
catch ( TaskExecutionException e )
{
getLogger().error( "Error executing task first time, continuing anyway: " + e.getMessage(), e );
}
} }
catch ( TaskExecutionException e ) else
{ {
getLogger().error( "Error executing task first time, continuing anyway: " + e.getMessage(), e ); getLogger().info( "Not scheduling indexer - index path is not configured" );
} }
// TODO: wire in the converter // TODO: wire in the converter
@ -159,6 +166,5 @@ public class DefaultRepositoryTaskScheduler
throws TaskExecutionException throws TaskExecutionException
{ {
indexerTask.execute(); indexerTask.execute();
} }
} }