From dad8b4b5dc2ad22556968b878c466a59ba80933a Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 31 Oct 2012 16:32:41 -0400
Subject: [PATCH] Don't even bother running Lucene indexer if we are GCing anything

---
 src/com/gitblit/GCExecutor.java |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/com/gitblit/GCExecutor.java b/src/com/gitblit/GCExecutor.java
index 243cbb9..312baf5 100644
--- a/src/com/gitblit/GCExecutor.java
+++ b/src/com/gitblit/GCExecutor.java
@@ -53,6 +53,8 @@
 
 	private final IStoredSettings settings;
 	
+	private AtomicBoolean running = new AtomicBoolean(false);
+	
 	private AtomicBoolean forceClose = new AtomicBoolean(false);
 	
 	private final Map<String, GCStatus> gcCache = new ConcurrentHashMap<String, GCStatus>();
@@ -68,6 +70,10 @@
 	 */
 	public boolean isReady() {
 		return settings.getBoolean(Keys.git.enableGarbageCollection, false);
+	}
+	
+	public boolean isRunning() {
+		return running.get();
 	}
 	
 	public boolean lock(String repositoryName) {
@@ -121,6 +127,8 @@
 		if (!isReady()) {
 			return;
 		}
+		
+		running.set(true);		
 		Date now = new Date();
 
 		for (String repositoryName : GitBlit.self().getRepositoryList()) {
@@ -205,6 +213,8 @@
 				logger.debug(MessageFormat.format("GCExecutor released GC lock for {0}", repositoryName));
 			}
 		}
+		
+		running.set(false);
 	}
 	
 	private boolean isRepositoryIdle(FileRepository repository) {

--
Gitblit v1.9.1