@Test public void flush() throws Exception { BinlogDataId _115 = getFromString("mysql-bin.000115/1234360405/139/0"); map.append(_115, 2); map.flush(); BinlogDataId s = getFromString(new String(FileBasedMap.readData(PATH))); Assert.assertEquals(s, _115); map.remove(_115, 1); BinlogDataId _116 = getFromString("mysql-bin.000116/1305/139/0"); map.append(_116, 1); map.flush(); s = getFromString(new String(FileBasedMap.readData(PATH))); Assert.assertEquals(s, _115); map.remove(_115, 1); s = getFromString(new String(FileBasedMap.readData(PATH))); Assert.assertEquals(s, _115); map.flush(); s = getFromString(new String(FileBasedMap.readData(PATH))); Assert.assertEquals(s, _116); map.remove(_116, 1); BinlogDataId _117 = getFromString("mysql-bin.000117/1305/13/0"); map.append(_117, 1); map.flush(); s = getFromString(new String(FileBasedMap.readData(PATH))); Assert.assertEquals(s, _117); }
public boolean flush() { T toFlush = getToFlush(); if (toFlush == null) { return false; } byte[] bytes = toFlush.toString().getBytes(StandardCharsets.UTF_8); putBytes(file, bytes); file.force(); return true; }
FileBasedMap { public boolean flush() { T toFlush = getToFlush(); if (toFlush == null) { return false; } byte[] bytes = toFlush.toString().getBytes(StandardCharsets.UTF_8); putBytes(file, bytes); file.force(); return true; } }
FileBasedMap { public boolean flush() { T toFlush = getToFlush(); if (toFlush == null) { return false; } byte[] bytes = toFlush.toString().getBytes(StandardCharsets.UTF_8); putBytes(file, bytes); file.force(); return true; } FileBasedMap(Path path); }
FileBasedMap { public boolean flush() { T toFlush = getToFlush(); if (toFlush == null) { return false; } byte[] bytes = toFlush.toString().getBytes(StandardCharsets.UTF_8); putBytes(file, bytes); file.force(); return true; } FileBasedMap(Path path); static byte[] readData(Path path); boolean append(T data, int count); boolean remove(T data, int count); boolean flush(); }
FileBasedMap { public boolean flush() { T toFlush = getToFlush(); if (toFlush == null) { return false; } byte[] bytes = toFlush.toString().getBytes(StandardCharsets.UTF_8); putBytes(file, bytes); file.force(); return true; } FileBasedMap(Path path); static byte[] readData(Path path); boolean append(T data, int count); boolean remove(T data, int count); boolean flush();  }