Hi,

On Mon, Feb 6, 2017 at 1:23 PM, John English <[email protected]> wrote:
> I'm having a play with this, but I still don't understand what the parameter
> to reload is for. I see in the example you use it to change the keystore
> path:
>
> sslContextFactory.reload(sslContextFactory -> {
>   if (sslContextFactory.getKeyStorePath().endsWith(KEYSTORE_1))
>     sslContextFactory.setKeyStorePath(KEYSTORE_2);
>   else
>     sslContextFactory.setKeyStorePath(KEYSTORE_1);
> });
>
> but what does this give that this doesn't?
>
> if (sslContextFactory.getKeyStorePath().endsWith(KEYSTORE_1))
>   sslContextFactory.setKeyStorePath(KEYSTORE_2);
> else
>   sslContextFactory.setKeyStorePath(KEYSTORE_1);
> sslContextFactory.reload(sslContextFactory -> { });
>
> I'm still getting used to Java 8, so forgive me if this is a stupid
> question...

The calls within the Consumer are performed with locks held so that
the updates are "atomic" with respect to the reload.
If you modify the SslContextFactory outside the Consumer, two threads
trying to reload may interfere with each other, while performing the
modification within the consumer will serialize the reloads.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to