@@ -83,6 +83,7 @@ public class OperationSupport {
83
83
protected String apiGroupVersion ;
84
84
protected boolean dryRun ;
85
85
private final int requestRetryBackoffLimit ;
86
+ private final int requestRetryBackoffInterval ;
86
87
87
88
public OperationSupport (Client client ) {
88
89
this (new OperationContext ().withClient (client ));
@@ -106,8 +107,10 @@ public OperationSupport(OperationContext ctx) {
106
107
}
107
108
108
109
if (ctx .getConfig () != null ) {
110
+ requestRetryBackoffInterval = ctx .getConfig ().getRequestRetryBackoffInterval ();
109
111
this .requestRetryBackoffLimit = ctx .getConfig ().getRequestRetryBackoffLimit ();
110
112
} else {
113
+ requestRetryBackoffInterval = Config .DEFAULT_REQUEST_RETRY_BACKOFFINTERVAL ;
111
114
this .requestRetryBackoffLimit = Config .DEFAULT_REQUEST_RETRY_BACKOFFLIMIT ;
112
115
}
113
116
}
@@ -508,15 +511,11 @@ protected <T> T waitForResult(CompletableFuture<T> future) throws IOException {
508
511
if (e .getCause () != null ) {
509
512
t = e .getCause ();
510
513
}
514
+ // throw a new exception to preserve the calling stack trace
511
515
if (t instanceof IOException ) {
512
- throw ( IOException ) t ;
516
+ throw new IOException ( t . getMessage (), t ) ;
513
517
}
514
- if (t instanceof RuntimeException ) {
515
- throw (RuntimeException ) t ;
516
- }
517
- InterruptedIOException ie = new InterruptedIOException ();
518
- ie .initCause (e );
519
- throw ie ;
518
+ throw new KubernetesClientException (t .getMessage (), t );
520
519
}
521
520
}
522
521
@@ -568,7 +567,7 @@ protected <T> CompletableFuture<T> handleResponse(HttpClient client, HttpRequest
568
567
HttpRequest request = requestBuilder .build ();
569
568
CompletableFuture <HttpResponse <byte []>> futureResponse = new CompletableFuture <>();
570
569
retryWithExponentialBackoff (futureResponse ,
571
- new ExponentialBackoffIntervalCalculator (requestRetryBackoffLimit , MAX_RETRY_INTERVAL_EXPONENT ),
570
+ new ExponentialBackoffIntervalCalculator (requestRetryBackoffInterval , MAX_RETRY_INTERVAL_EXPONENT ),
572
571
Utils .getNonNullOrElse (client , httpClient ), request );
573
572
574
573
return futureResponse .thenApply (response -> {
0 commit comments