Search in sources :

Example 1 with BeginDownloadResult

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);
    }
}
Also used : BufferInputStream(org.apache.storm.utils.BufferInputStream) TException(org.apache.storm.thrift.TException) InputStreamWithMeta(org.apache.storm.blobstore.InputStreamWithMeta) BeginDownloadResult(org.apache.storm.generated.BeginDownloadResult) WrappedAuthorizationException(org.apache.storm.utils.WrappedAuthorizationException) IOException(java.io.IOException) IllegalStateException(org.apache.storm.generated.IllegalStateException) AlreadyAliveException(org.apache.storm.generated.AlreadyAliveException) WrappedNotAliveException(org.apache.storm.utils.WrappedNotAliveException) WrappedInvalidTopologyException(org.apache.storm.utils.WrappedInvalidTopologyException) AuthorizationException(org.apache.storm.generated.AuthorizationException) NotAliveException(org.apache.storm.generated.NotAliveException) WrappedAlreadyAliveException(org.apache.storm.utils.WrappedAlreadyAliveException) InterruptedIOException(java.io.InterruptedIOException) KeyAlreadyExistsException(org.apache.storm.generated.KeyAlreadyExistsException) TException(org.apache.storm.thrift.TException) WrappedIllegalStateException(org.apache.storm.utils.WrappedIllegalStateException) KeyNotFoundException(org.apache.storm.generated.KeyNotFoundException) InvalidTopologyException(org.apache.storm.generated.InvalidTopologyException) BindException(java.net.BindException)

Aggregations

IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 BindException (java.net.BindException)1 InputStreamWithMeta (org.apache.storm.blobstore.InputStreamWithMeta)1 AlreadyAliveException (org.apache.storm.generated.AlreadyAliveException)1 AuthorizationException (org.apache.storm.generated.AuthorizationException)1 BeginDownloadResult (org.apache.storm.generated.BeginDownloadResult)1 IllegalStateException (org.apache.storm.generated.IllegalStateException)1 InvalidTopologyException (org.apache.storm.generated.InvalidTopologyException)1 KeyAlreadyExistsException (org.apache.storm.generated.KeyAlreadyExistsException)1 KeyNotFoundException (org.apache.storm.generated.KeyNotFoundException)1 NotAliveException (org.apache.storm.generated.NotAliveException)1 TException (org.apache.storm.thrift.TException)1 BufferInputStream (org.apache.storm.utils.BufferInputStream)1 WrappedAlreadyAliveException (org.apache.storm.utils.WrappedAlreadyAliveException)1 WrappedAuthorizationException (org.apache.storm.utils.WrappedAuthorizationException)1 WrappedIllegalStateException (org.apache.storm.utils.WrappedIllegalStateException)1 WrappedInvalidTopologyException (org.apache.storm.utils.WrappedInvalidTopologyException)1 WrappedNotAliveException (org.apache.storm.utils.WrappedNotAliveException)1