DistributedData implements Writable { synchronized public void format() throws IOException { setDataVersion(0); setIsInIncrementRestoreStage(false, false); } DistributedData(); ReentrantReadWriteLockExtension setDataLocker(ReentrantReadWriteLockExtension getDataLocker); String getDataPath(); synchronized void open(); synchronized final boolean becomeMasterPre(ServerType oldServerType); synchronized final boolean becomeMasterPost(ServerType oldServerType); synchronized final boolean leaveMasterPre(ServerType newServerType); synchronized final boolean leaveMasterPost(ServerType newServerType); boolean becomeMasterPreInteranl(ServerType oldServerType); boolean becomeMasterPostInteranl(ServerType oldServerType); boolean leaveMasterPreInteranl(ServerType newServerType); boolean leaveMasterPostInteranl(ServerType newServerType); boolean isValid(); DistributedOperationQueue getOperationQueue(); synchronized void close(); synchronized void backup(); synchronized void format(); long getDataVersion(); long setDataVersion(long newVersion); void readFields(DataInput in); void write(DataOutput out); Object getElementToTransfer(String key); Object putElementToTransfer(String key, Object value); Object removeElementToTransfer(String key); Class<?>[] getDataProtocols(); synchronized DistributedData getData(DistributedData oldData,
      ReentrantReadWriteLockExtension.WriteLock writeLock); DistributedData getDataAll(DistributedData oldData, ReentrantReadWriteLockExtension.WriteLock writeLock); DistributedData getDataIncrement(DistributedData oldData, ReentrantReadWriteLockExtension.WriteLock writeLock); void setData(DistributedData newData); void setDataAll(DistributedData newData); void setDataIncrement(DistributedData newData); Object invoke(Invocation invocation); Object invokeDirectly(Invocation invocation); boolean getIsInIncrementRestoreStage(boolean onlyReadFromMemory); void setIsInIncrementRestoreStage(boolean isInIncrementRestoreStage, boolean onlyWriteToMemory); boolean getIsIncrementRestoreEnabled(); void setIsIncrementRestoreEnabled(boolean isIncrementRestoreEnabled); static Class<?> getDistributedInvocationType(Method method); static String getDataClientClassName(String dataClassName); static final Logger logger; public Configuration conf; }
@Test public void format() throws Exception { exampleData.write("jiwan@taobao.com"); assertThat(exampleData.getDataVersion() == 1, is(true)); assertThat(exampleData.read().equals("jiwan@taobao.com"), is(true)); exampleData.format(); assertThat(exampleData.getDataVersion() == 0, is(true)); assertThat(exampleData.read().isEmpty(), is(true)); }