@@ -121,7 +121,7 @@ public final class Suggester implements Closeable {
121
121
* @param allowedFields fields for which should the suggester be enabled,
122
122
* if {@code null} then enabled for all fields
123
123
* @param timeThreshold time in milliseconds after which the suggestions requests should time out
124
- * @param registry
124
+ * @param registry meter registry
125
125
*/
126
126
public Suggester (
127
127
final File suggesterDir ,
@@ -196,10 +196,12 @@ public void init(final Collection<NamedIndexDir> luceneIndexes) {
196
196
* wait for initialization to finish.
197
197
* @param timeout timeout value
198
198
* @param unit timeout unit
199
- * @throws InterruptedException
199
+ * @throws InterruptedException on canceled await()
200
200
*/
201
201
public void waitForInit (long timeout , TimeUnit unit ) throws InterruptedException {
202
- initDone .await (timeout , unit );
202
+ if (!initDone .await (timeout , unit )) {
203
+ LOGGER .log (Level .WARNING , "Initialization did not finish in {0} {1}" , new Object [] {timeout , unit });
204
+ }
203
205
}
204
206
205
207
private void submitInitIfIndexExists (final ExecutorService executorService , final NamedIndexDir indexDir ) {
@@ -236,7 +238,7 @@ private Runnable getInitRunnable(final NamedIndexDir indexDir) {
236
238
Duration d = Duration .between (start , Instant .now ());
237
239
LOGGER .log (Level .FINE , "Finished initialization of {0}, took {1}" , new Object [] {indexDir , d });
238
240
} catch (Exception e ) {
239
- LOGGER .log (Level .SEVERE , "Could not initialize suggester data for " + indexDir , e );
241
+ LOGGER .log (Level .SEVERE , String . format ( "Could not initialize suggester data for %s" , indexDir ) , e );
240
242
}
241
243
};
242
244
}
@@ -322,13 +324,15 @@ public void rebuild(final Collection<NamedIndexDir> indexDirs) {
322
324
* wait for rebuild to finish.
323
325
* @param timeout timeout value
324
326
* @param unit timeout unit
325
- * @throws InterruptedException
327
+ * @throws InterruptedException on canceled await()
326
328
*/
327
329
public void waitForRebuild (long timeout , TimeUnit unit ) throws InterruptedException {
328
330
rebuildLock .lock ();
329
331
try {
330
332
while (rebuilding ) {
331
- rebuildDone .await (timeout , unit );
333
+ if (!rebuildDone .await (timeout , unit )) {
334
+ LOGGER .log (Level .WARNING , "Rebuild did not finish in {0} {1}" , new Object [] {timeout , unit });
335
+ }
332
336
}
333
337
} finally {
334
338
rebuildLock .unlock ();
@@ -610,7 +614,7 @@ public void close() {
610
614
try {
611
615
f .close ();
612
616
} catch (IOException e ) {
613
- LOGGER .log (Level .WARNING , "Could not close suggester data " + f , e );
617
+ LOGGER .log (Level .WARNING , String . format ( "Could not close suggester data %s" , f ) , e );
614
618
}
615
619
});
616
620
}
0 commit comments