@@ -98,32 +98,21 @@ public ChunkedUploadRequest(final String requestUrl,
9898 @ SuppressWarnings ("unchecked" )
9999 public <UploadType > ChunkedUploadResult <UploadType > upload (
100100 final ChunkedUploadResponseHandler <UploadType > responseHandler ) {
101- while (this .retryCount < this .maxRetry ) {
102- try {
103- Thread .sleep (RETRY_DELAY * this .retryCount * this .retryCount );
104- } catch (final InterruptedException e ) {
105- throw new ClientException ("Exception while waiting to retry file upload." , e );
106- }
107-
108- ChunkedUploadResult <UploadType > result = null ;
109-
110- try {
111- result = this .baseRequest
112- .getClient ()
113- .getHttpProvider ()
114- .send (baseRequest , (Class <ChunkedUploadResult <UploadType >>)(Class <?>) ChunkedUploadResult .class , this .data , responseHandler );
115- } catch (final ClientException e ) {
116- throw new ClientException ("Request failed with error, retry if necessary." , e );
117- }
118-
119- if (result != null && result .chunkCompleted ()) {
120- return result ;
121- }
122-
123- this .retryCount ++;
101+ ChunkedUploadResult <UploadType > result = null ;
102+
103+ try {
104+ result = this .baseRequest
105+ .getClient ()
106+ .getHttpProvider ()
107+ .send (baseRequest , (Class <ChunkedUploadResult <UploadType >>)(Class <?>) ChunkedUploadResult .class , this .data , responseHandler );
108+ } catch (final ClientException e ) {
109+ throw new ClientException ("Request failed with error, retry if necessary." , e );
124110 }
125111
126- return new ChunkedUploadResult <UploadType >(
127- new ClientException ("Upload session failed too many times." , null ));
112+ if (result != null && result .chunkCompleted ()) {
113+ return result ;
114+ } else
115+ return new ChunkedUploadResult <UploadType >(
116+ new ClientException ("Upload session failed." , null ));
128117 }
129118}
0 commit comments