@Test public void testCreate() { HttpClientFactory httpClientFactory = new HttpClientFactory(); httpClientFactory.setHttpMethodRetryHandlerClass(GobblinHttpMethodRetryHandler.class.getName()); HttpClient client = httpClientFactory.create(); Assert.assertNotNull(client); }
@Override public HttpClient create() { HttpClient client = new HttpClient(); if (soTimeout >= 0) { client.getParams().setSoTimeout(soTimeout); } ClassAliasResolver<HttpMethodRetryHandler> aliasResolver = new ClassAliasResolver<>(HttpMethodRetryHandler.class); HttpMethodRetryHandler httpMethodRetryHandler; try { httpMethodRetryHandler = GobblinConstructorUtils.invokeLongestConstructor(aliasResolver.resolveClass(httpMethodRetryHandlerClass), httpMethodRetryCount, httpRequestSentRetryEnabled); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, httpMethodRetryHandler); if (connTimeout >= 0) { client.getHttpConnectionManager().getParams().setConnectionTimeout(connTimeout); } return client; }
HttpClientFactory extends BasePooledObjectFactory<HttpClient> { @Override public HttpClient create() { HttpClient client = new HttpClient(); if (soTimeout >= 0) { client.getParams().setSoTimeout(soTimeout); } ClassAliasResolver<HttpMethodRetryHandler> aliasResolver = new ClassAliasResolver<>(HttpMethodRetryHandler.class); HttpMethodRetryHandler httpMethodRetryHandler; try { httpMethodRetryHandler = GobblinConstructorUtils.invokeLongestConstructor(aliasResolver.resolveClass(httpMethodRetryHandlerClass), httpMethodRetryCount, httpRequestSentRetryEnabled); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, httpMethodRetryHandler); if (connTimeout >= 0) { client.getHttpConnectionManager().getParams().setConnectionTimeout(connTimeout); } return client; } }
HttpClientFactory extends BasePooledObjectFactory<HttpClient> { @Override public HttpClient create() { HttpClient client = new HttpClient(); if (soTimeout >= 0) { client.getParams().setSoTimeout(soTimeout); } ClassAliasResolver<HttpMethodRetryHandler> aliasResolver = new ClassAliasResolver<>(HttpMethodRetryHandler.class); HttpMethodRetryHandler httpMethodRetryHandler; try { httpMethodRetryHandler = GobblinConstructorUtils.invokeLongestConstructor(aliasResolver.resolveClass(httpMethodRetryHandlerClass), httpMethodRetryCount, httpRequestSentRetryEnabled); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, httpMethodRetryHandler); if (connTimeout >= 0) { client.getHttpConnectionManager().getParams().setConnectionTimeout(connTimeout); } return client; } HttpClientFactory(); }
HttpClientFactory extends BasePooledObjectFactory<HttpClient> { @Override public HttpClient create() { HttpClient client = new HttpClient(); if (soTimeout >= 0) { client.getParams().setSoTimeout(soTimeout); } ClassAliasResolver<HttpMethodRetryHandler> aliasResolver = new ClassAliasResolver<>(HttpMethodRetryHandler.class); HttpMethodRetryHandler httpMethodRetryHandler; try { httpMethodRetryHandler = GobblinConstructorUtils.invokeLongestConstructor(aliasResolver.resolveClass(httpMethodRetryHandlerClass), httpMethodRetryCount, httpRequestSentRetryEnabled); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, httpMethodRetryHandler); if (connTimeout >= 0) { client.getHttpConnectionManager().getParams().setConnectionTimeout(connTimeout); } return client; } HttpClientFactory(); @Override HttpClient create(); @Override PooledObject<HttpClient> wrap(HttpClient obj); }
HttpClientFactory extends BasePooledObjectFactory<HttpClient> { @Override public HttpClient create() { HttpClient client = new HttpClient(); if (soTimeout >= 0) { client.getParams().setSoTimeout(soTimeout); } ClassAliasResolver<HttpMethodRetryHandler> aliasResolver = new ClassAliasResolver<>(HttpMethodRetryHandler.class); HttpMethodRetryHandler httpMethodRetryHandler; try { httpMethodRetryHandler = GobblinConstructorUtils.invokeLongestConstructor(aliasResolver.resolveClass(httpMethodRetryHandlerClass), httpMethodRetryCount, httpRequestSentRetryEnabled); } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, httpMethodRetryHandler); if (connTimeout >= 0) { client.getHttpConnectionManager().getParams().setConnectionTimeout(connTimeout); } return client; } HttpClientFactory(); @Override HttpClient create(); @Override PooledObject<HttpClient> wrap(HttpClient obj);  }