/** * Add a block to the binary blob. */ protected void addKeyToBinaryBlob(ClientKeyBlock block, ClientContext context) { if(binaryBlobWriter == null) return; synchronized(this) { if(finished) { if(logMINOR) Logger.minor(this, "Add key to binary blob for "+this+" but already finished"); return; } } if(logMINOR) Logger.minor(this, "Adding key "+block.getClientKey().getURI()+" to "+this, new Exception("debug")); try { binaryBlobWriter.addKey(block, context); } catch (IOException e) { Logger.error(this, "Failed to write key to binary blob stream: "+e, e); onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to write key to binary blob stream: "+e), null, context); } catch (BinaryBlobAlreadyClosedException e) { Logger.error(this, "Failed to write key to binary blob stream (already closed??): "+e, e); onFailure(new FetchException(FetchExceptionMode.BUCKET_ERROR, "Failed to write key to binary blob stream (already closed??): "+e), null, context); } }