jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Cole <notificati...@github.com>
Subject Re: [jclouds] JCLOUDS-753: Make ConnectionSpec configurable in the OkHttp driver (#619)
Date Sun, 30 Nov 2014 17:10:36 GMT
suggestion on how to rejig out of needing to use guice inheritance. 


sidebar..

Another way, which could avoid constantly punching holes could be to allow the user a callback
to customize the base okhttp client.

Ex. 
```java
interface ConfigureOkHttpClient {
   /** Use this to customize the base okhttp client used for all connection. For example,
set a custom ssl context, cache, or connection specs here. **/
   OkHttpClient beforeProvides(OkHttpClient client);
}
```

Then, you could use set bindings on something similarly named to above to ensure that providers
like docker set the ssl context in a way that doesn't require inheritance, optional injection,
etc, yet still allowing users to customize further as needed. Only problem is that not all
set bindings retain insertion order, so if both the base provider tried to alter protocols
and also the user did.. it may be unclear who would win. That's the downside of using more
than one callback with set bindings.

Another way is to allow only one to be configured, and use composition instead.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/619#issuecomment-64991836
Mime
View raw message