use of backtype.storm.generated.BeginDownloadResult in project jstorm by alibaba.
the class ServiceHandler method beginBlobDownload.
@Override
public BeginDownloadResult beginBlobDownload(String key) throws TException {
InputStreamWithMeta is = data.getBlobStore().getBlob(key);
String sessionId = UUID.randomUUID().toString();
BeginDownloadResult result = null;
try {
result = new BeginDownloadResult(is.getVersion(), sessionId);
result.set_data_size(is.getFileLength());
int bufferSize = JStormUtils.parseInt(data.getConf().get(Config.STORM_BLOBSTORE_INPUTSTREAM_BUFFER_SIZE_BYTES), 65536);
BufferInputStream bufferedIS = new BufferInputStream(is, bufferSize);
data.getBlobDownloaders().put(sessionId, bufferedIS);
} catch (IOException e) {
LOG.error("beginBlobDownload error", e);
throw new TException(e);
}
return result;
}
Aggregations