List of usage examples for org.apache.commons.io.output LockableFileWriter write
public void write(String str) throws IOException
From source file:de.ipbhalle.metfrag.tools.Writer.java
/** * Write to file and prevent that this file is overwritten by another thread while writing to it. * //w w w . ja va2 s .c o m * @param file the file * @param content the content * * @throws InterruptedException the interrupted exception */ public static void writeToFile(String file, String content) throws InterruptedException { try { LockableFileWriter lfw = new LockableFileWriter(file, true, "/home/swolf/locks/"); lfw.write(content); lfw.close(); } catch (Exception e) { Thread.sleep(10); writeToFile(file, content); } }