mirror of https://github.com/apache/jclouds.git
Re-optimize LocalBlobStore.getBlob with ranges
This fixes a memory regression from
8de7b696e1
where the transient BlobStore
changed from a ByteSource to a byte[].
This commit is contained in:
parent
2791f47046
commit
d1bd51f7f1
|
@ -682,10 +682,13 @@ public final class LocalBlobStore implements BlobStore {
|
|||
|
||||
// Try to convert payload to ByteSource, otherwise wrap it.
|
||||
ByteSource byteSource;
|
||||
try {
|
||||
byteSource = (ByteSource) blob.getPayload().getRawContent();
|
||||
} catch (ClassCastException cce) {
|
||||
// This should not happen; both FilesystemStorageStrategyImpl and TransientStorageStrategy return ByteSource
|
||||
Object object = blob.getPayload().getRawContent();
|
||||
if (object instanceof ByteSource) {
|
||||
byteSource = (ByteSource) object;
|
||||
} else if (object instanceof byte[]) {
|
||||
byteSource = ByteSource.wrap((byte[]) object);
|
||||
} else {
|
||||
// This should not happen.
|
||||
try {
|
||||
byteSource = ByteSource.wrap(ByteStreams2.toByteArrayAndClose(blob.getPayload().openStream()));
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue