private ChunkKey endChunk(int typeCode) throws DhtException { ChunkFormatter w = openChunks[typeCode]; if (w == null) return null; openChunks[typeCode] = null; currChunk = null; if (w.isEmpty()) return null; ChunkKey key = w.end(chunkKeyDigest); ChunkInfo info = w.getChunkInfo(); if (chunkByOrder[typeCode] == null) chunkByOrder[typeCode] = new ArrayList<ChunkKey>(); chunkByOrder[typeCode].add(key); infoByKey.put(key, info); if (w.getChunkMeta() != null) chunkMeta.put(key, w.getChunkMeta()); Edges e = openEdges[typeCode]; if (e != null) { chunkEdges.put(key, e); openEdges[typeCode] = null; } if (currFragments == null) chunkReadBackCache.put(key, w.getPackChunk()); w.unsafePut(db, dbWriteBuffer); return key; }
private ChunkKey endChunk(int typeCode) throws DhtException { ChunkFormatter w = openChunks[typeCode]; if (w == null) return null; openChunks[typeCode] = null; currChunk = null; if (w.isEmpty()) return null; ChunkKey key = w.end(chunkKeyDigest); ChunkInfo info = w.getChunkInfo(); if (chunkByOrder[typeCode] == null) chunkByOrder[typeCode] = new ArrayList<ChunkKey>(); chunkByOrder[typeCode].add(key); infoByKey.put(key, info); if (w.getChunkMeta() != null) chunkMeta.put(key, w.getChunkMeta()); Edges e = openEdges[typeCode]; if (e != null) { chunkEdges.put(key, e); openEdges[typeCode] = null; } if (currFragments == null) chunkReadBackCache.put(key, w.getPackChunk()); w.unsafePut(db, dbWriteBuffer); return key; }