java - JClouds: BlobStore.getBlob() taking a long time -
i'm using jclouds 1.6.1-incubating in web application (using scala playframework 2.1.3, shouldn't matter).
since other methods in jclouds receive blob seem deprecated, want use
blobstore.getblob(container,name).getpayload().getinput()
to input stream of stored data. want stream data browser without having store whole blob on server.
sometimes want metadata like
blobstore.getblob(container,name).getmetadata().getcontentmetadata().getcontentlength()
however, call to
blobstore.getblob(container,name)
takes long return (i assume, loads blob memory). causes webapp unresponsive after user clicks "download". i'd cloud data start streaming browser (playframework supports that).
when want metadata, timeout worse (i might want metadata many files without downloading of them webapp).
am right? blobstore.getblob(container,name) downloading file before returning? there way asynchronous input stream can directly send browser?
you can query metadata with:
blobmetadata metadata = blobstore.blobmetadata(container, name); long contentlength = metadata.getcontentmetadata().getcontentlength();
blobstore.getblob
initiates download not download entire blob data. instead streams data via payload or inputstream. block until blobstore returns blob metadata.
note should call payload.close ensure close underlying socket.
Comments
Post a Comment