public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if (mostRecent != null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }
private void persistInternal(Map<String, ThriftSerializedObject> serialized, TSerializer ser, boolean cleanup) { try { if (ser == null) { ser = new TSerializer(); } byte[] toWrite = ser.serialize(new LocalStateData(serialized)); String newPath = _vs.createVersion(); File file = new File(newPath); FileUtils.writeByteArrayToFile(file, toWrite); if (toWrite.length != file.length()) { throw new IOException("Tried to serialize " + toWrite.length + " bytes to " + file.getCanonicalPath() + ", but " + file.length() + " bytes were written."); } _vs.succeedVersion(newPath); if (cleanup) { _vs.cleanup(4); } } catch (Exception e) { throw new RuntimeException(e); } }
public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if(mostRecent!=null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }
private void persistInternal(Map<String, ThriftSerializedObject> serialized, TSerializer ser, boolean cleanup) { try { if (ser == null) { ser = new TSerializer(); } byte[] toWrite = ser.serialize(new LocalStateData(serialized)); String newPath = _vs.createVersion(); File file = new File(newPath); FileUtils.writeByteArrayToFile(file, toWrite); if (toWrite.length != file.length()) { throw new IOException("Tried to serialize " + toWrite.length + " bytes to " + file.getCanonicalPath() + ", but " + file.length() + " bytes were written."); } _vs.succeedVersion(newPath); if(cleanup) _vs.cleanup(4); } catch(Exception e) { throw new RuntimeException(e); } }