IndexDatabase.java revision 580
352N/A * See LICENSE.txt included in this distribution for the specific
352N/A * file and include the License file at LICENSE.txt.
352N/Apublic class IndexDatabase {
352N/A private boolean interrupted;
352N/A initialize();
352N/A initialize();
352N/A static void updateAll(ExecutorService executor, IndexChangedListener listener) throws IOException {
352N/A throw new FileNotFoundException("Failed to create root directory [" + indexDir.getAbsolutePath() + "]");
352N/A throw new FileNotFoundException("Failed to create root directory [" + spellDir.getAbsolutePath() + "]");
synchronized (lock) {
if (running) {
running = true;
interrupted = false;
while (uidIter.term() != null && uidIter.term().field().equals("u") && uidIter.term().text().startsWith(startuid)) {
removeFile();
} catch (IOException e) {
synchronized (lock) {
running = false;
optimize();
public void run() {
} catch (IOException e) {
public void optimize() {
synchronized (lock) {
if (running) {
running = true;
synchronized (lock) {
dirty = false;
} catch (IOException e) {
} catch (IOException e) {
synchronized (lock) {
running = false;
public void createSpellingSuggestions() {
} catch (IOException e) {
} catch (IOException e) {
private boolean isDirty() {
synchronized (lock) {
return dirty;
private void setDirty() {
synchronized (lock) {
dirty = true;
} catch (IOException e) {
setDirty();
if (d == null) {
setDirty();
if (isInterrupted()) {
String uid = Util.uid(path, DateTools.timeToString(file.lastModified(), DateTools.Resolution.MILLISECOND)); // construct uid for doc
removeFile();
public void interrupt() {
synchronized (lock) {
interrupted = true;
private boolean isInterrupted() {
synchronized (lock) {
return interrupted;
} catch (IOException e) {
} catch (IOException e) {
} catch (IOException e) {
} catch (IOException e) {
if (p == null) {
return null;
return ret;
if (this.project != other.project && (this.project == null || !this.project.equals(other.project))) {
public int hashCode() {
return hash;