AsyncSnapshotWriterImpl implements AsyncSnapshotWriter { @Override @CheckReturnValue public boolean flushAndResetMap() { if (!initCurrentMap()) { return false; } for (int i = 0; i < buffers.length; i++) { if (!flushPartition(i)) { return false; } } currentMap = null; if (logger.isFineEnabled()) { logger.fine(String.format("Stats for %s: keys=%,d, chunks=%,d, bytes=%,d", vertexName, totalKeys, totalChunks, totalPayloadBytes)); } return true; } AsyncSnapshotWriterImpl(NodeEngine nodeEngine,
                                   SnapshotContext snapshotContext,
                                   String vertexName,
                                   int memberIndex,
                                   int memberCount,
                                   SerializationService serializationService);   AsyncSnapshotWriterImpl(int chunkSize,
                            NodeEngine nodeEngine,
                            SnapshotContext snapshotContext,
                            String vertexName,
                            int memberIndex,
                            int memberCount,
                            SerializationService serializationService); @Override @CheckReturnValue boolean offer(Entry<? extends Data, ? extends Data> entry); @Override @CheckReturnValue boolean flushAndResetMap(); @Override void resetStats(); @Override boolean hasPendingAsyncOps(); @Override Throwable getError(); @Override boolean isEmpty(); @Override long getTotalPayloadBytes(); @Override long getTotalKeys(); @Override long getTotalChunks(); static final int DEFAULT_CHUNK_SIZE; }
@Test public void when_noItemsAndNoCurrentMap_then_flushAndResetReturnsFalse() { when(snapshotContext.currentMapName()).thenReturn(null); assertFalse(writer.flushAndResetMap()); when(snapshotContext.currentMapName()).thenReturn("map1"); }