BinaryBlobInserter(Bucket blob, ClientPutter parent, RequestClient clientContext, boolean tolerant, short prioClass, InsertContext ctx, ClientContext context)
throws IOException, BinaryBlobFormatException {
logMINOR = Logger.shouldLog(LogLevel.MINOR, this);
this.ctx = ctx;
this.maxRetries = ctx.maxInsertRetries;
this.consecutiveRNFsCountAsSuccess = ctx.consecutiveRNFsCountAsSuccess;
this.parent = parent;
this.clientContext = clientContext;
this.errors = new FailureCodeTracker(true);
this.realTimeFlag = clientContext.realTimeFlag();
DataInputStream dis = new DataInputStream(blob.getInputStream());
BlockSet blocks = new SimpleBlockSet();
try {
BinaryBlob.readBinaryBlob(dis, blocks, tolerant);
} finally {
dis.close();
}
ArrayList<MySendableInsert> myInserters = new ArrayList<MySendableInsert>();
int x=0;
for(Key key: blocks.keys()) {
KeyBlock block = blocks.get(key);
MySendableInsert inserter =
new MySendableInsert(x++, block, prioClass, getScheduler(block, context), clientContext);
myInserters.add(inserter);
}
inserters = myInserters.toArray(new MySendableInsert[myInserters.size()]);
parent.addMustSucceedBlocks(inserters.length);
parent.notifyClients(context);
}