36
36
import java .io .IOException ;
37
37
import java .nio .file .Path ;
38
38
import java .time .Duration ;
39
+ import java .time .Instant ;
39
40
import java .util .Collection ;
40
41
import java .util .Collections ;
41
42
import java .util .List ;
@@ -143,6 +144,7 @@ private void submitInitIfIndexExists(final ExecutorService executorService, fina
143
144
private Runnable getInitRunnable (final Path indexDir ) {
144
145
return () -> {
145
146
try {
147
+ Instant start = Instant .now ();
146
148
logger .log (Level .FINE , "Initializing {0}" , indexDir );
147
149
148
150
FieldWFSTCollection wfst = new FieldWFSTCollection (FSDirectory .open (indexDir ), getSuggesterDir (indexDir ),
@@ -154,7 +156,8 @@ private Runnable getInitRunnable(final Path indexDir) {
154
156
projectData .put (PROJECTS_DISABLED_KEY , wfst );
155
157
}
156
158
157
- logger .log (Level .FINE , "Finished initialization of {0}" , indexDir );
159
+ Duration d = Duration .between (start , Instant .now ());
160
+ logger .log (Level .FINE , "Finished initialization of {0}, took {1}" , new Object [] {indexDir , d });
158
161
} catch (Exception e ) {
159
162
logger .log (Level .SEVERE , "Could not initialize suggester data for " + indexDir , e );
160
163
}
@@ -216,9 +219,12 @@ public void rebuild(final List<Path> indexDirs) {
216
219
private Runnable getRebuildRunnable (final FieldWFSTCollection fieldsWFST ) {
217
220
return () -> {
218
221
try {
222
+ Instant start = Instant .now ();
219
223
logger .log (Level .FINE , "Rebuilding {0}" , fieldsWFST );
220
224
fieldsWFST .rebuild ();
221
- logger .log (Level .FINE , "Rebuild of {0} finished" , fieldsWFST );
225
+
226
+ Duration d = Duration .between (start , Instant .now ());
227
+ logger .log (Level .FINE , "Rebuild of {0} finished, took {1}" , new Object [] {fieldsWFST , d });
222
228
} catch (Exception e ) {
223
229
logger .log (Level .SEVERE , "Could not rebuild suggester" , e );
224
230
}
0 commit comments