.net - Amazon S3: BeginUpload() vs new thread with Upload() -
i'm working amazon s3 transfer utility (for .net). currently, using .beginupload() function create asynchronous thread upload file while main thread continues processing.
i'm running problem, however, transferutility throw error, cancelling upload. seems thread abort (without log4net exceptions logged).
because of this, i'm reconsidering method i'm using making upload asynchronous. see 2 options:
- beginupload(), iasyncresult, start new thread calls .endupload(result)
- spawn new thread calls .upload directly (instead of .beginupload()).
my question:
if started new thread upload queue, work in same way .beginupload()/.endupload() calls?
in other words this:
iasyncresult ar = mytransferutility.beginupload(uploadrequest); threadpool.queueuserworkitem(c => { try { mytransferutility.endupload(ar); } catch (exception ex) { handleexception(ex, "asynch uploading"); } });
versus
threadpool.queueuserworkitem(c => { try { mytransferutility.upload(uploadrequest); } catch (exception ex) { handleexception(ex, "asynch uploading"); } });
what's difference?
(there uploadcompleted callback doesn't called when these rare exceptions/aborts occur. callback want guarantee happens. in "catch".)
Comments
Post a Comment