Skip to content

Commit 81784be

Browse files
authored
Merge pull request #1730 from vladak/get_rid_of_startIndexReopenThread
get rid of startIndexReopenThread()
2 parents abe0dab + e258dff commit 81784be

File tree

3 files changed

+0
-56
lines changed

3 files changed

+0
-56
lines changed

src/org/opensolaris/opengrok/configuration/Configuration.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ public final class Configuration {
176176
private final Map<String, String> cmds; // repository type -> command
177177
private int tabSize;
178178
private int commandTimeout; // in seconds
179-
private int indexRefreshPeriod; // in seconds
180179
private boolean scopesEnabled;
181180
private boolean projectsEnabled;
182181
private boolean foldingEnabled;
@@ -309,14 +308,6 @@ public void setCommandTimeout(int commandTimeout) throws IllegalArgumentExceptio
309308
this.commandTimeout = commandTimeout;
310309
}
311310

312-
public int getIndexRefreshPeriod() {
313-
return indexRefreshPeriod;
314-
}
315-
316-
public void setIndexRefreshPeriod(int seconds) {
317-
this.indexRefreshPeriod = seconds;
318-
}
319-
320311
public String getStatisticsFilePath() {
321312
return statisticsFilePath;
322313
}
@@ -380,7 +371,6 @@ public Configuration() {
380371
setHitsPerPage(25);
381372
setIgnoredNames(new IgnoredNames());
382373
setIncludedNames(new Filter());
383-
setIndexRefreshPeriod(3600);
384374
setIndexVersionedFilesOnly(false);
385375
setLastEditedDisplayMode(true);
386376
setMaxSearchThreadCount(2 * Runtime.getRuntime().availableProcessors());

src/org/opensolaris/opengrok/configuration/RuntimeEnvironment.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,6 @@ public void setCommandTimeout(int timeout) {
281281
threadConfig.get().setCommandTimeout(timeout);
282282
}
283283

284-
public int getIndexRefreshPeriod() {
285-
return threadConfig.get().getIndexRefreshPeriod();
286-
}
287-
288-
public void setIndexRefreshPeriod(int seconds) {
289-
threadConfig.get().setIndexRefreshPeriod(seconds);
290-
}
291-
292284
public Statistics getStatistics() {
293285
return statistics;
294286
}
@@ -1970,42 +1962,6 @@ public void maybeRefreshIndexSearchers() {
19701962
}
19711963
}
19721964

1973-
/**
1974-
* Call maybeRefresh() on each SearcherManager object from dedicated thread
1975-
* periodically.
1976-
* If the corresponding index has changed in the meantime, it will be safely
1977-
* reopened, i.e. without impacting existing IndexSearcher/IndexReader
1978-
* objects, thus not disrupting searches in progress.
1979-
*/
1980-
public void startIndexReopenThread() {
1981-
indexReopenThread = new Thread(new Runnable() {
1982-
@Override
1983-
public void run() {
1984-
while (!Thread.currentThread().isInterrupted()) {
1985-
try {
1986-
maybeRefreshIndexSearchers();
1987-
Thread.sleep(getIndexRefreshPeriod() * 1000);
1988-
} catch (InterruptedException ex) {
1989-
Thread.currentThread().interrupt();
1990-
}
1991-
}
1992-
}
1993-
}, "indexReopenThread");
1994-
1995-
indexReopenThread.start();
1996-
}
1997-
1998-
public void stopIndexReopenThread() {
1999-
if (indexReopenThread != null) {
2000-
indexReopenThread.interrupt();
2001-
try {
2002-
indexReopenThread.join();
2003-
} catch (InterruptedException ex) {
2004-
LOGGER.log(Level.INFO, "Cannot join indexReopen thread: ", ex);
2005-
}
2006-
}
2007-
}
2008-
20091965
/**
20101966
* Get IndexSearcher for given project.
20111967
* Each IndexSearcher is born from a SearcherManager object. There is

src/org/opensolaris/opengrok/web/WebappListener.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
115115
RuntimeEnvironment.getInstance().startWatchDogService(new File(env.getConfiguration().getPluginDirectory()));
116116
}
117117

118-
RuntimeEnvironment.getInstance().startIndexReopenThread();
119118
RuntimeEnvironment.getInstance().startExpirationTimer();
120119

121120
try {
@@ -134,7 +133,6 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
134133
public void contextDestroyed(final ServletContextEvent servletContextEvent) {
135134
RuntimeEnvironment.getInstance().stopConfigurationListenerThread();
136135
RuntimeEnvironment.getInstance().stopWatchDogService();
137-
RuntimeEnvironment.getInstance().stopIndexReopenThread();
138136
RuntimeEnvironment.getInstance().stopExpirationTimer();
139137
try {
140138
RuntimeEnvironment.getInstance().saveStatistics();

0 commit comments

Comments
 (0)