public String getID() throws IOException { return Long.toString(al.getAndAdd(getIncrement())); }
public void reset() { try { lock.lock(); super.reset(); writeNextValue(0l); } catch (IOException e) { throw new IllegalStateException("Cannot initialize persistent ID generator", e); } finally { lock.unlock(); } }
public synchronized void reset() { set(0l); }
public String getID() throws IOException { try { lock.lock(); // If ID is 0, read initial value from file if possible if (!minimizeReads || !used) { long readInitialValue = readInitialValue(getFilePath()); if (readInitialValue >= 0) { set(readInitialValue); } used = true; } String id = super.getID(); // The id held in the file is always <increment> larger so that // the ID is still unique after a restart. writeNextValue(Long.parseLong(id) + getIncrement()); return id; } finally { lock.unlock(); } }
connection.activate(); final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA"; final IDGenerator generator = new InMemoryIDGenerator();
public String getID() throws IOException { try { lock.lock(); // If ID is 0, read initial value from file if possible if (!minimizeReads || !used) { long readInitialValue = readInitialValue(getFilePath()); if (readInitialValue >= 0) { set(readInitialValue); } used = true; } String id = super.getID(); // The id held in the file is always <increment> larger so that // the ID is still unique after a restart. writeNextValue(Long.parseLong(id) + getIncrement()); return id; } finally { lock.unlock(); } }
connection.activate(); final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA"; final IDGenerator generator = new InMemoryIDGenerator();
public void reset() { try { lock.lock(); super.reset(); writeNextValue(0l); } catch (IOException e) { throw new IllegalStateException("Cannot initialize persistent ID generator", e); } finally { lock.unlock(); } }
public String getID() throws IOException { return Long.toString(al.getAndAdd(getIncrement())); }
public synchronized void reset() { set(0l); }