Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 07e0d11

Browse files
committed
Add thread count to admin page and update documentation to mention quartz
1 parent 08be147 commit 07e0d11

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/main/java/com/searchcode/app/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public static void main(String[] args) {
391391
return true;
392392
}, new JsonTransformer());
393393

394-
get("/getstat/", "application/json", (request, response) -> {
394+
get("/getstat/", (request, response) -> {
395395
checkLoggedIn(request, response);
396396
AdminRouteService adminRouteService = new AdminRouteService();
397397
return adminRouteService.getStat(request, response);

src/main/java/com/searchcode/app/service/route/AdminRouteService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public Map<String, Object> adminPage(Request request, Response response) {
131131
map.put("currentdatetime", this.getStat("servertime"));
132132
map.put("spellingCount", this.getStat("spellingCount"));
133133
map.put("runningJobs", this.getStat("runningJobs"));
134+
map.put("threads", this.getStat("threads"));
134135

135136

136137
map.put("sysArch", statsService.getArch());
@@ -433,6 +434,8 @@ private String getStat(String statname) {
433434
return StringUtils.join(Singleton.getLogger().getSevereLogs(), System.lineSeparator());
434435
case "searchlogs":
435436
return StringUtils.join(Singleton.getLogger().getSearchLogs(), System.lineSeparator());
437+
case "threads":
438+
return "" + java.lang.Thread.activeCount();
436439
}
437440
return Values.EMPTYSTRING;
438441
}

src/main/resources/spark/template/freemarker/admin.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<br>Uptime: <span ic-poll="60s" ic-src="/admin/api/getstat/?statname=uptime">${uptime}</span>
3939
<br>Version: ${version} <a ic-get-from="/admin/checkversion/" ic-indicator="#demo-spinner">(check if latest version)</a>
4040
<i id="demo-spinner" class="fa fa-spinner fa-spin" style="display:none"><img src="/img/loading_small.gif" /></i>
41+
<br>Threads: <span ic-poll="60s" ic-src="/admin/api/getstat/?statname=threads">${threads}</span>
4142
</div>
4243
</div>
4344
</div>

src/main/resources/spark/template/freemarker/documentation.ftl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ String myHmac = HmacUtils.hmacSha512Hex(MYPRIVATEKEY, PARAMSTOHMAC);</textarea>
569569

570570
<h3 id="properties">Properties</h3>
571571

572+
<p>There are two properties files in the base directory of searchcode server, searchcode.properties and quartz.properties.</p>
573+
572574
<p>
573575
The searchcode.properties file in the base directory is a simple text file that can be used to configure aspects of searchcode server. By default
574576
it is setup using suggested defaults. <b>It is important to note that the password to administer your server is located
@@ -654,6 +656,13 @@ String myHmac = HmacUtils.hmacSha512Hex(MYPRIVATEKEY, PARAMSTOHMAC);</textarea>
654656

655657
</p>
656658

659+
<p>
660+
The quartz.properties file in the base directory should only need to be modified when changing the searchcode.properties values of number_git_processors, number_svn_processors and number_file_processors.
661+
By default searchcode spawns 10 background threads which are used for repository processing and internal processing logic. By itself searchcode uses 5 threads
662+
by itself leaving over 5 for background repository processing tasks. If you adjust the number of repository processors higher then you should increase the value for
663+
org.quartz.threadPool.threadCount to a higher number up-to a maximum of 100.
664+
</p>
665+
657666
<h3 id="settings">Settings</h3>
658667

659668
<p>

0 commit comments

Comments
 (0)