/** Starts auto refresh */
 public void start() {
   stop();
   if (stateRepository.getAutoRepositoryRefreshTime() > 0) {
     Logger.info(
         "Repository will refresh automatically every ",
         stateRepository.getAutoRepositoryRefreshTime(),
         " minutes");
     task =
         taskService.submitPeriodically(
             "RepositoryAutoRefresher",
             30,
             stateRepository.getAutoRepositoryRefreshTime() * 60L,
             this);
   } else {
     Logger.info("Repository will not refresh automatically");
   }
 }
 @Override
 public void run() {
   if (!repositoryHandler.isLoaderWorking()) {
     Logger.info(
         StringUtils.getString(
             "Automatically refreshing repository... (", new DateTime().toString(), ')'));
     repositoryHandler.refreshRepository();
   }
 }
 /** Stops auto refresh */
 public void stop() {
   if (task != null) {
     Logger.info("Cancelling previous pending task for automatically refresh repository");
     task.cancel(true);
   }
 }