@@ -217,27 +217,27 @@ are declared in the
217217#### Support for Supplier and Publisher as Option Values
218218Most options can have a value provided by a ` Supplier ` or ` Publisher ` .
219219
220- Oracle R2DBC requests the value of a ` Option ` from a ` Supplier ` or ` Publisher `
221- each time ` ConnectionFactory.create() ` is called to create a new ` Connection ` . This
222- allows connections to be configured with values that change over time, such as a
223- password that gets periodically rotated.
220+ Oracle R2DBC requests the value of an ` Option ` from a ` Supplier ` or ` Publisher `
221+ each time the ` Publisher ` returned by ` ConnectionFactory.create() ` creates a new
222+ ` Connection ` . Each ` Connection ` can then be configured with values that change
223+ over time, such as a password which is periodically rotated.
224224
225225If a ` Supplier ` provides the value of an ` Option ` , then Oracle R2DBC requests
226226the value by invoking ` Supplier.get() ` . If ` get() ` returns ` null ` ,
227227then no value is configured for the ` Option ` . If ` get() ` throws a
228228` RuntimeException ` , then it is set as the initial cause of an
229- ` R2dbcException ` emitted by the ` create() ` ` Publisher ` . If concurrent
230- access to a ` ConnectionFactory ` is possible, then the ` Supplier ` must have a
231- thread safe ` get() ` method, as multiple threads may invoke
232- ` ConnectionFactory.create() ` concurrently.
229+ ` R2dbcException ` emitted by the ` Publisher ` returned by
230+ ` ConnectionFactory.create() ` . The ` Supplier ` must have a thread safe ` get() `
231+ method, as multiple subscribers may request connections concurrently.
233232
234233If a ` Publisher ` provides the value of an ` Option ` , then Oracle R2DBC requests
235234the value by subscribing to the ` Publisher ` and signalling demand.
236235The first value emitted to ` onNext ` will be used as the value of the ` Option ` .
237236If the ` Publisher ` emits ` onComplete ` before ` onNext ` , then no value is
238237configured for the ` Option ` . If the ` Publisher ` emits ` onError ` before ` onNext ` ,
239- then the ` Throwable ` is set as the initial cause of an ` R2dbcException ` emitted
240- by the ` create() ` ` Publisher ` .
238+ then the ` Throwable ` is set as the initial cause of an
239+ ` R2dbcException ` emitted by the ` Publisher ` returned by
240+ ` ConnectionFactory.create() ` .
241241
242242The following example configures the ` PASSWORD ` option with a ` Supplier ` :
243243``` java
@@ -253,7 +253,7 @@ The following example configures the `PASSWORD` option with a `Supplier`:
253253 optionsBuilder. option(suppliedOption, supplier);
254254 }
255255```
256- A similar and more concise example configures ` TLS_WALLET_PASSWORD ` as a ` Publisher `
256+ A more concise example configures ` TLS_WALLET_PASSWORD ` as a ` Publisher `
257257``` java
258258 void configurePassword(ConnectionFactoryOptions . Builder optionsBuilder) {
259259 optionsBuilder. option(
@@ -263,13 +263,12 @@ A similar and more concise example configures `TLS_WALLET_PASSWORD` as a `Publis
263263```
264264These examples use the ` supplied(Option) ` and ` published(Option) ` methods
265265declared by ` oracle.r2dbc.OracleR2dbcOptions ` . These methods cast an ` Option<T> `
266- to ` Option<Supplier<T>> ` or ` Option<Publisher<T>> ` , respectively. Casting the
267- ` Option ` is required for
268- ` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` to compile and not throw
269- a ` ClassCastException ` at runtime.
270-
271- It is not strictly necessary to use the ` supplied(Option) ` or ` published(Option) ` methods when
272- casting the ` Option ` . These methods are offered only for code readability and
266+ to ` Option<Supplier<T>> ` and ` Option<Publisher<T>> ` , respectively. It is
267+ necessary to cast the generic type of the ` Option ` when calling
268+ ` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` in order for the call to
269+ compile and not throw a ` ClassCastException ` at runtime. It is not strictly
270+ required that ` supplied(Option) ` or ` published(Option) ` be used to cast the
271+ ` Option ` . These methods are only meant to offer code readability and
273272convenience.
274273
275274Note that the following code would compile, but fails at runtime with a
@@ -285,8 +284,8 @@ To avoid a `ClassCastException`, the generic type of an `Option` must match the
285284actual type of the value passed to
286285` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` .
287286
288- Providing values with a ` Supplier ` or ` Publisher ` is not supported for a small
289- set of options :
287+ For a small set of options, providing values with a ` Supplier ` or ` Publisher `
288+ is not supported :
290289- ` DRIVER `
291290- ` PROTOCOL `
292291
0 commit comments