@@ -34,10 +34,10 @@ public final class AzureClient extends AzureServiceClient {
3434 private static final String LOGGING_HEADER = "x-ms-logging-context" ;
3535
3636 /**
37- * The interval time between two long running operation polls. Default is
38- * used if null.
37+ * The interval time between two long running operation polls. Default is 30 seconds.
3938 */
40- private Integer longRunningOperationRetryTimeout ;
39+ private int longRunningOperationRetryTimeout = -1 ;
40+
4141 /**
4242 * The executor for asynchronous requests.
4343 */
@@ -63,16 +63,20 @@ public AzureClient(AzureServiceClient serviceClient) {
6363 *
6464 * @return the time in seconds.
6565 */
66- public Integer getLongRunningOperationRetryTimeout () {
66+ public Integer longRunningOperationRetryTimeout () {
6767 return longRunningOperationRetryTimeout ;
6868 }
6969
7070 /**
71- * Sets the interval time between two long running operation polls.
71+ * Sets the interval time between two long running operation polls. Default is 30 seconds.
72+ * Set to any negative value to let AzureClient ignore this setting.
7273 *
73- * @param longRunningOperationRetryTimeout the time in seconds.
74+ * @param longRunningOperationRetryTimeout the time in seconds. Set to any negative value to let AzureClient ignore this setting.
7475 */
75- public void withLongRunningOperationRetryTimeout (Integer longRunningOperationRetryTimeout ) {
76+ public void setLongRunningOperationRetryTimeout (int longRunningOperationRetryTimeout ) {
77+ if (longRunningOperationRetryTimeout < 0 ) {
78+ throw new IllegalArgumentException ("Invalid timeout for long running operations : " + longRunningOperationRetryTimeout );
79+ }
7680 this .longRunningOperationRetryTimeout = longRunningOperationRetryTimeout ;
7781 }
7882
@@ -137,7 +141,7 @@ public Observable<ServiceResponse<T>> call(Response<ResponseBody> response) {
137141 }
138142
139143 try {
140- final PollingState <T > pollingState = new PollingState <>(response , getLongRunningOperationRetryTimeout (), resourceType , restClient ().serializerAdapter ());
144+ final PollingState <T > pollingState = new PollingState <>(response , longRunningOperationRetryTimeout (), resourceType , restClient ().serializerAdapter ());
141145 final String url = response .raw ().request ().url ().toString ();
142146
143147 // Task runner will take it from here
@@ -294,7 +298,7 @@ public Observable<ServiceResponse<T>> call(Response<ResponseBody> response) {
294298 }
295299
296300 try {
297- final PollingState <T > pollingState = new PollingState <>(response , getLongRunningOperationRetryTimeout (), resourceType , restClient ().serializerAdapter ());
301+ final PollingState <T > pollingState = new PollingState <>(response , longRunningOperationRetryTimeout (), resourceType , restClient ().serializerAdapter ());
298302 return Observable .just (pollingState )
299303 .subscribeOn (Schedulers .io ())
300304 // Emit a polling task intermittently
0 commit comments