flushBuffer();
}
protected synchronized void flushBuffer() throws IOException {
if( dirtyBuffer ) {
ShardedJedis jd = redisPool.getResource();
if( RedisDirectory.COMPRESSED ){
byte[] compressed = Snappy.compress(buffer);
jd.set(blockAddress(), compressed);
}else{
jd.set(blockAddress(), buffer);
}
if( fileExtended ){
jd.hset(directory.getDirNameBytes(), getNameBytes(), ByteBuffer.allocate(Long.SIZE/8).putLong(fileLength).array());
directory.reloadSizeFromFiles();
fileExtended = false;
}
redisPool.returnResource(jd);
}