@Test public void testGetInstance() throws Exception { builder1.setMaxRedirects(4); builder2.setConnectTimeout(300); assertNotEquals(builder1, builder2); ParsecAsyncHttpClient client1 = ParsecAsyncHttpClientFactory.getInstance(builder1); assertEquals(client1.getMaxRedirects(), 4); ParsecAsyncHttpClientFactory.getInstance(builder1); Map instanceMap = ParsecAsyncHttpClientFactory.getInstanceMap(); assertEquals(instanceMap.size(), 1); ParsecAsyncHttpClient client2 = ParsecAsyncHttpClientFactory.getInstance(builder2); assertEquals(client2.getConnectTimeout(), 300); assertEquals(instanceMap.size(), 2); }
public static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder) { return clientMap.computeIfAbsent(builder, b -> { return b.build(); }); }
ParsecAsyncHttpClientFactory { public static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder) { return clientMap.computeIfAbsent(builder, b -> { return b.build(); }); } }
ParsecAsyncHttpClientFactory { public static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder) { return clientMap.computeIfAbsent(builder, b -> { return b.build(); }); } private  ParsecAsyncHttpClientFactory(); }
ParsecAsyncHttpClientFactory { public static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder) { return clientMap.computeIfAbsent(builder, b -> { return b.build(); }); } private  ParsecAsyncHttpClientFactory(); static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder); static ParsecAsyncHttpClient removeInstance(final ParsecAsyncHttpClient.Builder builder); static void clearAllInstances(); }
ParsecAsyncHttpClientFactory { public static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder) { return clientMap.computeIfAbsent(builder, b -> { return b.build(); }); } private  ParsecAsyncHttpClientFactory(); static ParsecAsyncHttpClient getInstance(final ParsecAsyncHttpClient.Builder builder); static ParsecAsyncHttpClient removeInstance(final ParsecAsyncHttpClient.Builder builder); static void clearAllInstances();  }