Skip to content

Commit e258dff

Browse files
committed
get rid of startIndexReopenThread()
fixes #1729
1 parent ab0d13e commit e258dff

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;
@@ -304,14 +303,6 @@ public void setCommandTimeout(int commandTimeout) throws IllegalArgumentExceptio
304303
this.commandTimeout = commandTimeout;
305304
}
306305

307-
public int getIndexRefreshPeriod() {
308-
return indexRefreshPeriod;
309-
}
310-
311-
public void setIndexRefreshPeriod(int seconds) {
312-
this.indexRefreshPeriod = seconds;
313-
}
314-
315306
public String getStatisticsFilePath() {
316307
return statisticsFilePath;
317308
}
@@ -374,7 +365,6 @@ public Configuration() {
374365
setHitsPerPage(25);
375366
setIgnoredNames(new IgnoredNames());
376367
setIncludedNames(new Filter());
377-
setIndexRefreshPeriod(3600);
378368
setIndexVersionedFilesOnly(false);
379369
setLastEditedDisplayMode(true);
380370
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
}
@@ -1962,42 +1954,6 @@ public void maybeRefreshIndexSearchers() {
19621954
}
19631955
}
19641956

1965-
/**
1966-
* Call maybeRefresh() on each SearcherManager object from dedicated thread
1967-
* periodically.
1968-
* If the corresponding index has changed in the meantime, it will be safely
1969-
* reopened, i.e. without impacting existing IndexSearcher/IndexReader
1970-
* objects, thus not disrupting searches in progress.
1971-
*/
1972-
public void startIndexReopenThread() {
1973-
indexReopenThread = new Thread(new Runnable() {
1974-
@Override
1975-
public void run() {
1976-
while (!Thread.currentThread().isInterrupted()) {
1977-
try {
1978-
maybeRefreshIndexSearchers();
1979-
Thread.sleep(getIndexRefreshPeriod() * 1000);
1980-
} catch (InterruptedException ex) {
1981-
Thread.currentThread().interrupt();
1982-
}
1983-
}
1984-
}
1985-
}, "indexReopenThread");
1986-
1987-
indexReopenThread.start();
1988-
}
1989-
1990-
public void stopIndexReopenThread() {
1991-
if (indexReopenThread != null) {
1992-
indexReopenThread.interrupt();
1993-
try {
1994-
indexReopenThread.join();
1995-
} catch (InterruptedException ex) {
1996-
LOGGER.log(Level.INFO, "Cannot join indexReopen thread: ", ex);
1997-
}
1998-
}
1999-
}
2000-
20011957
/**
20021958
* Get IndexSearcher for given project.
20031959
* 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)