@@ -408,8 +408,6 @@ public static void main(String[] argv) {
408
408
if (webappURI != null && subFiles .isEmpty ()) {
409
409
getInstance ().sendToConfigHost (env , webappURI );
410
410
}
411
-
412
- env .getIndexerParallelizer ().bounce ();
413
411
} catch (ParseException e ) {
414
412
System .err .println ("** " + e .getMessage ());
415
413
System .exit (1 );
@@ -1129,65 +1127,66 @@ public void doIndexerExecution(List<String> subFiles, IndexChangedListener progr
1129
1127
LOGGER .info ("Starting indexing" );
1130
1128
1131
1129
RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
1132
- IndexerParallelizer parallelizer = env .getIndexerParallelizer ();
1133
- final CountDownLatch latch ;
1134
- if (subFiles == null || subFiles .isEmpty ()) {
1135
- latch = IndexDatabase .updateAll (progress );
1136
- } else {
1137
- List <IndexDatabase > dbs = new ArrayList <>();
1130
+ try ( IndexerParallelizer parallelizer = env .getIndexerParallelizer ()) {
1131
+ final CountDownLatch latch ;
1132
+ if (subFiles == null || subFiles .isEmpty ()) {
1133
+ latch = IndexDatabase .updateAll (progress );
1134
+ } else {
1135
+ List <IndexDatabase > dbs = new ArrayList <>();
1138
1136
1139
- for (String path : subFiles ) {
1140
- Project project = Project .getProject (path );
1141
- if (project == null && env .hasProjects ()) {
1142
- LOGGER .log (Level .WARNING , "Could not find a project for \" {0}\" " , path );
1143
- } else {
1144
- IndexDatabase db ;
1145
- if (project == null ) {
1146
- db = new IndexDatabase ();
1137
+ for (String path : subFiles ) {
1138
+ Project project = Project .getProject (path );
1139
+ if (project == null && env .hasProjects ()) {
1140
+ LOGGER .log (Level .WARNING , "Could not find a project for \" {0}\" " , path );
1147
1141
} else {
1148
- db = new IndexDatabase (project );
1149
- }
1150
- int idx = dbs .indexOf (db );
1151
- if (idx != -1 ) {
1152
- db = dbs .get (idx );
1153
- }
1142
+ IndexDatabase db ;
1143
+ if (project == null ) {
1144
+ db = new IndexDatabase ();
1145
+ } else {
1146
+ db = new IndexDatabase (project );
1147
+ }
1148
+ int idx = dbs .indexOf (db );
1149
+ if (idx != -1 ) {
1150
+ db = dbs .get (idx );
1151
+ }
1154
1152
1155
- if (db .addDirectory (path )) {
1156
- if (idx == -1 ) {
1157
- dbs .add (db );
1153
+ if (db .addDirectory (path )) {
1154
+ if (idx == -1 ) {
1155
+ dbs .add (db );
1156
+ }
1157
+ } else {
1158
+ LOGGER .log (Level .WARNING , "Directory does not exist \" {0}\" " , path );
1158
1159
}
1159
- } else {
1160
- LOGGER .log (Level .WARNING , "Directory does not exist \" {0}\" " , path );
1161
1160
}
1162
1161
}
1162
+
1163
+ latch = new CountDownLatch (dbs .size ());
1164
+ for (final IndexDatabase db : dbs ) {
1165
+ db .addIndexChangedListener (progress );
1166
+ parallelizer .getFixedExecutor ().submit (() -> {
1167
+ try {
1168
+ db .update ();
1169
+ } catch (Throwable e ) {
1170
+ LOGGER .log (Level .SEVERE , "An error occurred while updating index" , e );
1171
+ } finally {
1172
+ latch .countDown ();
1173
+ }
1174
+ });
1175
+ }
1163
1176
}
1164
1177
1165
- latch = new CountDownLatch (dbs .size ());
1166
- for (final IndexDatabase db : dbs ) {
1167
- db .addIndexChangedListener (progress );
1168
- parallelizer .getFixedExecutor ().submit (() -> {
1169
- try {
1170
- db .update ();
1171
- } catch (Throwable e ) {
1172
- LOGGER .log (Level .SEVERE , "An error occurred while updating index" , e );
1173
- } finally {
1174
- latch .countDown ();
1175
- }
1176
- });
1178
+ // Wait forever for the executors to finish.
1179
+ try {
1180
+ LOGGER .info ("Waiting for the executors to finish" );
1181
+ latch .await ();
1182
+ } catch (InterruptedException exp ) {
1183
+ LOGGER .log (Level .WARNING , "Received interrupt while waiting" +
1184
+ " for executor to finish" , exp );
1177
1185
}
1178
- }
1186
+ elapsed . report ( LOGGER , "Done indexing data of all repositories" , "indexer.repository.indexing" );
1179
1187
1180
- // Wait forever for the executors to finish.
1181
- try {
1182
- LOGGER .info ("Waiting for the executors to finish" );
1183
- latch .await ();
1184
- } catch (InterruptedException exp ) {
1185
- LOGGER .log (Level .WARNING , "Received interrupt while waiting" +
1186
- " for executor to finish" , exp );
1188
+ CtagsUtil .deleteTempFiles ();
1187
1189
}
1188
- elapsed .report (LOGGER , "Done indexing data of all repositories" , "indexer.repository.indexing" );
1189
-
1190
- CtagsUtil .deleteTempFiles ();
1191
1190
}
1192
1191
1193
1192
public void sendToConfigHost (RuntimeEnvironment env , String host ) {
0 commit comments