Skip to content

Commit bd5889f

Browse files
committed
Always wrap handlers with execution count limiter.
1 parent a927ff3 commit bd5889f

File tree

15 files changed

+18
-34
lines changed

15 files changed

+18
-34
lines changed

backblaze/src/main/java/ch/cyberduck/core/b2/B2Session.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import ch.cyberduck.core.exception.BackgroundException;
2929
import ch.cyberduck.core.features.*;
3030
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
31-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
3231
import ch.cyberduck.core.http.HttpSession;
3332
import ch.cyberduck.core.proxy.ProxyFinder;
3433
import ch.cyberduck.core.ssl.X509KeyManager;
@@ -63,7 +62,7 @@ public B2Session(final Host host, final X509TrustManager trust, final X509KeyMan
6362
protected B2ApiClient connect(final ProxyFinder proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) {
6463
final HttpClientBuilder configuration = builder.build(proxy, this, prompt);
6564
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(
66-
host, new ExecutionCountServiceUnavailableRetryStrategy(retryHandler = new B2ErrorResponseInterceptor(this, fileid))));
65+
host, retryHandler = new B2ErrorResponseInterceptor(this, fileid)));
6766
configuration.addInterceptorLast(retryHandler);
6867
return new B2ApiClient(configuration.build());
6968
}

box/src/main/java/ch/cyberduck/core/box/BoxSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import ch.cyberduck.core.features.Upload;
3939
import ch.cyberduck.core.features.Write;
4040
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
41-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
4241
import ch.cyberduck.core.http.HttpSession;
4342
import ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor;
4443
import ch.cyberduck.core.oauth.OAuth2RequestInterceptor;
@@ -71,7 +70,7 @@ public CloseableHttpClient connect(final ProxyFinder proxy, final HostKeyCallbac
7170
.withRedirectUri(host.getProtocol().getOAuthRedirectUrl());
7271
configuration.addInterceptorLast(authorizationService);
7372
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
74-
new ExecutionCountServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService))));
73+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
7574
return configuration.build();
7675
}
7776

brick/src/main/java/ch/cyberduck/core/brick/BrickSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import ch.cyberduck.core.features.Upload;
4949
import ch.cyberduck.core.features.Write;
5050
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
51-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
5251
import ch.cyberduck.core.http.HttpSession;
5352
import ch.cyberduck.core.local.BrowserLauncher;
5453
import ch.cyberduck.core.local.BrowserLauncherFactory;
@@ -82,7 +81,7 @@ public BrickSession(final Host host, final X509TrustManager trust, final X509Key
8281
protected CloseableHttpClient connect(final ProxyFinder proxy, final HostKeyCallback key, final LoginCallback prompt, final CancelCallback cancel) {
8382
final HttpClientBuilder configuration = builder.build(proxy, this, prompt);
8483
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
85-
new ExecutionCountServiceUnavailableRetryStrategy(retryHandler = new BrickUnauthorizedRetryStrategy(this, prompt, cancel))));
84+
retryHandler = new BrickUnauthorizedRetryStrategy(this, prompt, cancel)));
8685
configuration.addInterceptorLast(retryHandler);
8786
configuration.addInterceptorLast(new BrickPreferencesRequestInterceptor());
8887
return configuration.build();

core/src/main/java/ch/cyberduck/core/http/CustomServiceUnavailableRetryStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public CustomServiceUnavailableRetryStrategy(final Host host, final ServiceUnava
3838
}
3939

4040
public CustomServiceUnavailableRetryStrategy(final Host host, final int executionCount, final ServiceUnavailableRetryStrategy... chain) {
41-
super(new ChainedServiceUnavailableRetryStrategy(new ExecutionCountServiceUnavailableRetryStrategy(
42-
executionCount, new DefaultServiceUnavailableRetryStrategy(host)), new ChainedServiceUnavailableRetryStrategy(chain)));
41+
super(new ChainedServiceUnavailableRetryStrategy(new ExecutionCountServiceUnavailableRetryStrategy(executionCount, new DefaultServiceUnavailableRetryStrategy(host)),
42+
new ExecutionCountServiceUnavailableRetryStrategy(executionCount, new ChainedServiceUnavailableRetryStrategy(chain))));
4343
this.host = host;
4444
}
4545

ctera/src/main/java/ch/cyberduck/core/ctera/CteraSession.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import ch.cyberduck.core.features.*;
2727
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
2828
import ch.cyberduck.core.http.DefaultHttpResponseExceptionMappingService;
29-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
3029
import ch.cyberduck.core.http.HttpExceptionMappingService;
3130
import ch.cyberduck.core.proxy.ProxyFinder;
3231
import ch.cyberduck.core.shared.DefaultUrlProvider;
@@ -85,13 +84,12 @@ protected DAVClient connect(final ProxyFinder proxy, final HostKeyCallback key,
8584
configuration.disableRedirectHandling();
8685
if(preferences.getBoolean("ctera.download.directio.enable")) {
8786
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
88-
new ExecutionCountServiceUnavailableRetryStrategy(authentication = new CteraAuthenticationHandler(this, prompt),
89-
directio = new CteraDirectIOInterceptor(this))));
87+
authentication = new CteraAuthenticationHandler(this, prompt), directio = new CteraDirectIOInterceptor(this)));
9088
configuration.addInterceptorFirst(directio);
9189
}
9290
else {
9391
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
94-
new ExecutionCountServiceUnavailableRetryStrategy(authentication = new CteraAuthenticationHandler(this, prompt))));
92+
authentication = new CteraAuthenticationHandler(this, prompt)));
9593
}
9694
configuration.addInterceptorFirst(new CteraCookieInterceptor());
9795
final DAVClient client = new DAVClient(new HostUrlProvider().withUsername(false).get(host), configuration);

deepbox/src/main/java/ch/cyberduck/core/deepbox/DeepboxSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import ch.cyberduck.core.features.Trash;
4747
import ch.cyberduck.core.features.Write;
4848
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
49-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
5049
import ch.cyberduck.core.http.HttpSession;
5150
import ch.cyberduck.core.jersey.HttpComponentsProvider;
5251
import ch.cyberduck.core.oauth.OAuth2AuthorizationService;
@@ -112,7 +111,7 @@ else if(StringUtils.equals(wrapper.getTarget().getHostName(), preferences.getPro
112111
.withRedirectUri(host.getProtocol().getOAuthRedirectUrl()
113112
);
114113
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
115-
new ExecutionCountServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService))));
114+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
116115
configuration.addInterceptorLast(authorizationService);
117116
final String locale = this.pinLocalization();
118117
configuration.addInterceptorLast((HttpRequestInterceptor) (request, context) -> request.addHeader("Accept-Language", locale));

dracoon/src/main/java/ch/cyberduck/core/sds/SDSSession.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import ch.cyberduck.core.features.*;
2424
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
2525
import ch.cyberduck.core.http.DefaultHttpRateLimiter;
26-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
2726
import ch.cyberduck.core.http.HttpSession;
2827
import ch.cyberduck.core.http.RateLimitingHttpRequestInterceptor;
2928
import ch.cyberduck.core.jersey.HttpComponentsProvider;
@@ -187,9 +186,8 @@ public void process(final HttpRequest request, final HttpContext context) throws
187186
throw new DefaultIOExceptionMappingService().map(e);
188187
}
189188
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
190-
191-
new ExecutionCountServiceUnavailableRetryStrategy(new PreconditionFailedResponseInterceptor(host, authorizationService, prompt),
192-
new OAuth2ErrorResponseInterceptor(host, authorizationService))));
189+
new PreconditionFailedResponseInterceptor(host, authorizationService, prompt),
190+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
193191
if(HostPreferencesFactory.get(host).getBoolean("sds.limit.requests.enable")) {
194192
configuration.addInterceptorLast(new RateLimitingHttpRequestInterceptor(new DefaultHttpRateLimiter(
195193
HostPreferencesFactory.get(host).getInteger("sds.limit.requests.second")

dropbox/src/main/java/ch/cyberduck/core/dropbox/DropboxSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import ch.cyberduck.core.features.*;
3232
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
3333
import ch.cyberduck.core.http.DefaultHttpRateLimiter;
34-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
3534
import ch.cyberduck.core.http.HttpSession;
3635
import ch.cyberduck.core.http.RateLimitingHttpRequestInterceptor;
3736
import ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor;
@@ -81,7 +80,7 @@ protected CustomDbxRawClientV2 connect(final ProxyFinder proxy, final HostKeyCal
8180
.withParameter("token_access_type", "offline");
8281
configuration.addInterceptorLast(authorizationService);
8382
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
84-
new ExecutionCountServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService))));
83+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
8584
if(preferences.getBoolean("dropbox.limit.requests.enable")) {
8685
configuration.addInterceptorLast(new RateLimitingHttpRequestInterceptor(new DefaultHttpRateLimiter(
8786
preferences.getInteger("dropbox.limit.requests.second")

eue/src/main/java/ch/cyberduck/core/eue/EueSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
3434
import ch.cyberduck.core.http.DefaultHttpRateLimiter;
3535
import ch.cyberduck.core.http.DefaultHttpResponseExceptionMappingService;
36-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
3736
import ch.cyberduck.core.http.HttpSession;
3837
import ch.cyberduck.core.http.RateLimitingHttpRequestInterceptor;
3938
import ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor;
@@ -106,7 +105,7 @@ public void process(final HttpRequest request, final HttpContext context) {
106105
.withRedirectUri(host.getProtocol().getOAuthRedirectUrl()
107106
);
108107
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
109-
new ExecutionCountServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService))));
108+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
110109
configuration.addInterceptorLast(authorizationService);
111110
configuration.addInterceptorLast(new HttpRequestInterceptor() {
112111
@Override

googledrive/src/main/java/ch/cyberduck/core/googledrive/DriveSession.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import ch.cyberduck.core.features.*;
3131
import ch.cyberduck.core.http.CustomServiceUnavailableRetryStrategy;
3232
import ch.cyberduck.core.http.DefaultHttpRateLimiter;
33-
import ch.cyberduck.core.http.ExecutionCountServiceUnavailableRetryStrategy;
3433
import ch.cyberduck.core.http.HttpSession;
3534
import ch.cyberduck.core.http.RateLimitingHttpRequestInterceptor;
3635
import ch.cyberduck.core.http.UserAgentHttpRequestInitializer;
@@ -72,7 +71,7 @@ protected Drive connect(final ProxyFinder proxy, final HostKeyCallback callback,
7271
.withRedirectUri(host.getProtocol().getOAuthRedirectUrl());
7372
configuration.addInterceptorLast(authorizationService);
7473
configuration.setServiceUnavailableRetryStrategy(new CustomServiceUnavailableRetryStrategy(host,
75-
new ExecutionCountServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService))));
74+
new OAuth2ErrorResponseInterceptor(host, authorizationService)));
7675
if(preferences.getBoolean("googledrive.limit.requests.enable")) {
7776
configuration.addInterceptorLast(new RateLimitingHttpRequestInterceptor(new DefaultHttpRateLimiter(
7877
preferences.getInteger("googledrive.limit.requests.second")

0 commit comments

Comments
 (0)