Configure connection pooling and timeouts for the client

This commit is contained in:
Robin Müller 2016-05-10 09:51:02 +02:00
parent 99bde6fe1e
commit fb63a33763
1 changed files with 5 additions and 0 deletions

View File

@ -35,6 +35,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -55,6 +56,10 @@ public class GitLabClientBuilder {
builder.disableTrustManager();
}
return builder
.connectionPoolSize(60)
.maxPooledPerRoute(30)
.establishConnectionTimeout(10, TimeUnit.SECONDS)
.socketTimeout(10, TimeUnit.SECONDS)
.register(new JacksonJsonProvider())
.register(new JacksonConfig())
.register(new ApiHeaderTokenFilter(getApiToken(gitlabApiTokenId))).build().target(gitlabHostUrl)