Skip to content

Commit

Permalink
Fix documentation on default PromiseFactory.
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher authored Jun 28, 2016
1 parent 6e1f4cd commit 5df3de6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/en/guide/async/promises.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ h3. Promise Factories

The @Promises@ class uses a @grails.async.PromiseFactory@ instance to create @Promise@ instances.

The default implementation uses the GPars concurrency library and is called @org.grails.async.factory.gpars.GparsPromiseFactory@, however it is possible to swap implementations by setting the @Promises.promiseFactory@ variable.
The default implementation uses [Project Reactor|http://projectreactor.io] and is called @org.grails.async.factory.reactor.ReactorPromiseFactory@, however it is possible to swap implementations by setting the @Promises.promiseFactory@ variable.

One common use case for this is unit testing, typically you do not want promises to execute asynchronously during unit tests, as this makes tests harder to write. For this purpose Grails ships with a @org.grails.async.factory.SynchronousPromiseFactory@ instance that makes it easier to test promises:

Expand All @@ -150,8 +150,6 @@ import grails.async.*
Promises.promiseFactory = new SynchronousPromiseFactory()
{code}

Grails also has a @org.grails.async.factory.reactor.ReactorPromiseFactory@ which allows you to use the [Reactor|https://github.com/reactor/reactor]. You can use it by settings @Promises.promiseFactory@ as given above.

Using the @PromiseFactory@ mechanism it is theoretically possible to plug in other concurrency libraries into the Grails framework. For this you need to override the two interfaces @grails.async.Promise@ and @grails.async.PromiseFactory@.

h3. DelegateAsync Transformation
Expand Down

0 comments on commit 5df3de6

Please sign in to comment.