New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnixHttpClient.java:57-58: Connection pooling is... #52
Comments
* UnixHttpClient: swapped BasicHttpClientConnectionManager for PoolingHttpClientConnectionManager
@amihaiemil/z please, pay attention to this issue |
@0crat in |
@amihaiemil Job #52 is now in scope, role is |
@amihaiemil I suppose adding a I only ask because it doesn't look quite right to me. Also, do you think 10 is a reasonable default? |
@amihaiemil I'm now wondering if pooling could've been as simple as: new Pooled(
10,
() -> new LocalDocker(new File("/unix/socket"))
) |
No, definetely not; because we certainly needed a pool, so users would always have to do that -- most of them have no idea about connection pooling; or it's not something they think about every day. I also did not think about it before we had the bug.
I also don't really like this very much. Ideally, the users shouldn't know anything about pooling, the default 10 should be enough for most cases. I think we can add some sort of decorator, as you suggested :-? So somewhat what we already have + decoration: Docker docker = new PoolSize(
25,
new LocalDocker(...)
); This PoolSize decorator would only be needed if they want to increase it over the default 10. WDYT? |
I'm confused because the first half of your comment seemed to refute my proposal but then the 2nd half seemed to propose (almost) the same thing? |
@amihaiemil actually, I get you now. |
@llorllale In your proposal you seemed to hint that we should rollback the pooling we have now and use the decoration exclusively. I said the decoration is nice, but shouldn't be mandatory; so leave the default 10 we have and offer the decorator as an option for changing the pool :D |
Docker docker = new PoolSize(
25,
new LocalDocker(...)
); We'd need to change the second arg to be of type This might now be misleading btw... the semantics would imply a pool size of |
@llorllale hmmm, I see. I also had a look now. I think it would be a lot easier to just offer a ctor with that parameter in |
@amihaiemil no they'd just do this new Pooled(
2, //multiplies internal pool for a total of 20
() -> new LocalDocker(new File("")) //internal pool of 10
) |
@amihaiemil |
@llorllale but it would still need access to the underlying connection manager somehow, to see if instance x of The abstraction is too high and besides, it's the job of the HttpClient to manage connections, not of our abstraction layer. Actually, I think it's better to just make this ctor public and let the user supply their own client if they need tuning. The default 10 connections should be enough, always... and if they want to change the connection pool it means they know what they are doing and probably want to change more things. Besides making that ctor public, it should also have a Javadoc where we should let the user know that they can do whatever they want but they have to register a |
* Externalized ConnectionSocketFactory into 'UnixSocketFactory' * LocalDocker(HttpClient, String) now public for users * Added some javadocs
* Deleted puzzle
As per PR review: * Fixed javadoc
The puzzle |
Order was finished: +30 points just awarded to @llorllale/z |
The job #52 is now out of scope |
The puzzle
44-0db77e9f
from #44 has to be resolved:docker-java-api/src/main/java/com/amihaiemil/docker/UnixHttpClient.java
Lines 57 to 58 in 6009d3c
The puzzle was created by George Aristy on 15-Mar-18.
Estimate: 30 minutes, role: DEV.
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The text was updated successfully, but these errors were encountered: