Methods Summary |
---|
private static java.lang.String | buildElement(java.lang.String id, java.lang.String action)
StringBuilder builder = new StringBuilder("\t<indexentry>")
.append(LINE_BREAK);
builder.append("\t\t<entryid>");
builder.append(id);
builder.append("</entryid>").append(LINE_BREAK);
builder.append("\t\t<action>");
builder.append(action);
builder.append("</action>").append(LINE_BREAK);
builder.append("\t</indexentry>").append(LINE_BREAK);
return builder.toString();
|
synchronized void | close()
if (!this.isClosed.compareAndSet(false,true))
throw new IllegalStateException("Writer is already closed");
try {
this.writer.write(ROOT_END);
this.writer.flush();
} finally {
this.writer.close();
}
|
static synchronized void | tryCloseRoot(java.io.File file)
/*
* try to append the Root element end
* this happens if the server crashes.
* If it dies while writing an entry the log file has to be fixed manually
*/
RandomAccessFile raFile = new RandomAccessFile(file, "rw");
raFile.seek(raFile.length());
raFile.write(IndexLogWriter.ROOT_END.getBytes(CHARSET));
raFile.close();
|
synchronized void | writeAction(java.lang.String id, IndexAction action)
if (this.isClosed.get())
throw new IllegalStateException("Writer is already closed");
this.writer.write(buildElement(id, action.name()));
this.writer.flush();
|