private Map<Object, Object> deserializeLatestVersion() throws IOException { String latestPath = _vs.mostRecentVersionPath(); Long latestVersion = _vs.mostRecentVersion(); Map<Object, Object> result = new HashMap<>(); while (latestPath != null) { byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath)); if (serialized.length == 0) { LOG.warn("LocalState file '{}' contained no data, skip this state", latestPath); latestPath = _vs.mostRecentVersionPath(latestVersion - 1); latestVersion = _vs.mostRecentVersion(latestVersion - 1); } else { result = (Map<Object, Object>) Utils.javaDeserialize(serialized); break; } } return result; }
public String mostRecentVersionPath(long maxVersion) throws IOException { Long v = mostRecentVersion(maxVersion); if (v == null) return null; return versionPath(v); }
public String mostRecentVersionPath() throws IOException { Long v = mostRecentVersion(); if (v == null) return null; return versionPath(v); }
private Map<Object, Object> deserializeLatestVersion() throws IOException { String latestPath = _vs.mostRecentVersionPath(); Long latestVersion = _vs.mostRecentVersion(); Map<Object, Object> result = new HashMap<Object, Object>(); while (latestPath != null) { byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath)); if (serialized.length == 0) { LOG.warn("LocalState file '{}' contained no data, skip this state", latestPath); latestPath = _vs.mostRecentVersionPath(latestVersion - 1); latestVersion = _vs.mostRecentVersion(latestVersion - 1); } else { result = (Map<Object, Object>) Utils.javaDeserialize(serialized); break; } } return result; }
public String mostRecentVersionPath(long maxVersion) throws IOException { Long v = mostRecentVersion(maxVersion); if(v==null) return null; return versionPath(v); }
public String mostRecentVersionPath() throws IOException { Long v = mostRecentVersion(); if(v==null) return null; return versionPath(v); }
public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if (mostRecent != null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }
public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if(mostRecent!=null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }
public String mostRecentVersionPath(long maxVersion) throws IOException { Long v = mostRecentVersion(maxVersion); if(v==null) return null; return versionPath(v); }
public String mostRecentVersionPath() throws IOException { Long v = mostRecentVersion(); if(v==null) return null; return versionPath(v); }
public String mostRecentVersionPath() throws IOException { Long v = mostRecentVersion(); if (v == null) return null; return versionPath(v); }
public String mostRecentVersionPath(long maxVersion) throws IOException { Long v = mostRecentVersion(maxVersion); if (v == null) return null; return versionPath(v); }
public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if (mostRecent != null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }
public String createVersion() throws IOException { Long mostRecent = mostRecentVersion(); long version = Time.currentTimeMillis(); if(mostRecent!=null && version <= mostRecent) { version = mostRecent + 1; } return createVersion(version); }