*
* @throws IOException if an error occurs while reading.
*/
private void readStore() throws IOException {
if (dir.fileExists(INDEXING_QUEUE_FILE)) {
InputStream in = new IndexInputStream(dir.openInput(INDEXING_QUEUE_FILE));
BufferedReader reader = new BufferedReader(
new InputStreamReader(in, ENCODING));
try {
String line;
while ((line = reader.readLine()) != null) {
int idx = line.indexOf(' ');
if (idx == -1) {
// invalid line
log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
} else {
String cmd = line.substring(0, idx);
String uuid = line.substring(idx + 1, line.length());
if (ADD.equals(cmd)) {
pending.add(uuid);
} else if (REMOVE.equals(cmd)) {
pending.remove(uuid);
} else {
// invalid line
log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
}
}
}
} finally {
in.close();
}
}
}