use of org.apache.storm.generated.BeginDownloadResult in project storm by apache.
the class Nimbus method beginBlobDownload.
@SuppressWarnings("deprecation")
@Override
public BeginDownloadResult beginBlobDownload(String key) throws AuthorizationException, KeyNotFoundException, TException {
try {
InputStreamWithMeta is = blobStore.getBlob(key, getSubject());
String sessionId = Utils.uuid();
BeginDownloadResult ret = new BeginDownloadResult(is.getVersion(), sessionId);
ret.set_data_size(is.getFileLength());
blobDownloaders.put(sessionId, new BufferInputStream(is, (int) conf.getOrDefault(Config.STORM_BLOBSTORE_INPUTSTREAM_BUFFER_SIZE_BYTES, 65536)));
LOG.info("Created download session {} for {}", sessionId, key);
return ret;
} catch (Exception e) {
LOG.warn("begin blob download exception.", e);
if (e instanceof TException) {
throw (TException) e;
}
throw new RuntimeException(e);
}
}
Aggregations