James Moger
2013-11-13 c44dd099a432094a12131cf60dfc8a19f5aa8101
src/main/java/com/gitblit/GitBlit.java
@@ -164,7 +164,7 @@
   private final Logger logger = LoggerFactory.getLogger(GitBlit.class);
   private final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(5);
   private final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(10);
   private final List<FederationModel> federationRegistrations = Collections
         .synchronizedList(new ArrayList<FederationModel>());
@@ -206,6 +206,8 @@
   private LuceneExecutor luceneExecutor;
   private GCExecutor gcExecutor;
   private MirrorExecutor mirrorExecutor;
   private TimeZone timezone;
@@ -2015,7 +2017,6 @@
         model.verifyCommitter = getConfig(config, "verifyCommitter", false);
         model.showRemoteBranches = getConfig(config, "showRemoteBranches", hasOrigin);
         model.isFrozen = getConfig(config, "isFrozen", false);
         model.showReadme = getConfig(config, "showReadme", false);
         model.skipSizeCalculation = getConfig(config, "skipSizeCalculation", false);
         model.skipSummaryMetrics = getConfig(config, "skipSummaryMetrics", false);
         model.commitMessageRenderer = CommitMessageRenderer.fromName(getConfig(config, "commitMessageRenderer",
@@ -2036,6 +2037,7 @@
         model.origin = config.getString("remote", "origin", "url");
         if (model.origin != null) {
            model.origin = model.origin.replace('\\', '/');
            model.isMirror = config.getBoolean("remote", "origin", "mirror", false);
         }
         model.preReceiveScripts = new ArrayList<String>(Arrays.asList(config.getStringList(
               Constants.CONFIG_GITBLIT, null, "preReceiveScript")));
@@ -2578,7 +2580,6 @@
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "verifyCommitter", repository.verifyCommitter);
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "showRemoteBranches", repository.showRemoteBranches);
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFrozen", repository.isFrozen);
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "showReadme", repository.showReadme);
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSizeCalculation", repository.skipSizeCalculation);
      config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSummaryMetrics", repository.skipSummaryMetrics);
      config.setString(Constants.CONFIG_GITBLIT, null, "federationStrategy",
@@ -3507,6 +3508,7 @@
      mailExecutor = new MailExecutor(settings);
      luceneExecutor = new LuceneExecutor(settings, repositoriesFolder);
      gcExecutor = new GCExecutor(settings);
      mirrorExecutor = new MirrorExecutor(settings);
      // initialize utilities
      String prefix = settings.getString(Keys.git.userRepositoryPrefix, "~");
@@ -3546,6 +3548,7 @@
      configureMailExecutor();
      configureLuceneIndexing();
      configureGarbageCollector();
      configureMirrorExecutor();
      if (startFederation) {
         configureFederation();
      }
@@ -3594,6 +3597,19 @@
         }
         logger.info(MessageFormat.format("Next scheculed GC scan is in {0}", when));
         scheduledExecutor.scheduleAtFixedRate(gcExecutor, delay, 60*24, TimeUnit.MINUTES);
      }
   }
   protected void configureMirrorExecutor() {
      if (mirrorExecutor.isReady()) {
         int mins = TimeUtils.convertFrequencyToMinutes(settings.getString(Keys.git.mirrorPeriod, "30 mins"));
         if (mins < 5) {
            mins = 5;
         }
         int delay = 1;
         scheduledExecutor.scheduleAtFixedRate(mirrorExecutor, delay, mins,  TimeUnit.MINUTES);
         logger.info("Mirror executor is scheduled to fetch updates every {} minutes.", mins);
         logger.info("Next scheduled mirror fetch is in {} minutes", delay);
      }
   }
@@ -3866,6 +3882,7 @@
      scheduledExecutor.shutdownNow();
      luceneExecutor.close();
      gcExecutor.close();
      mirrorExecutor.close();
      if (fanoutService != null) {
         fanoutService.stop();
      }