Skip to content
Browse files

allow reseting the PromiseFactory to null

  • Loading branch information...
1 parent 08be857 commit 412ab68d2090641149e4528c2b30f4dba63695df @graemerocher graemerocher committed
Showing with 16 additions and 1 deletion.
  1. +16 −1 grails-async/src/main/groovy/grails/async/Promises.groovy
View
17 grails-async/src/main/groovy/grails/async/Promises.groovy
@@ -40,7 +40,22 @@ class Promises {
}
}
- /**
+ static PromiseFactory getPromiseFactory() {
+ if (promiseFactory == null) {
+ if (GparsPromiseFactory.isGparsAvailable()) {
+ promiseFactory = new GparsPromiseFactory()
+ }
+ else {
+ promiseFactory = new SynchronousPromiseFactory()
+ }
+ }
+ return promiseFactory
+ }
+
+ static void setPromiseFactory(PromiseFactory promiseFactory) {
+ Promises.promiseFactory = promiseFactory
+ }
+/**
* @see PromiseFactory#waitAll(grails.async.Promise[])
*/
static<T> List<T> waitAll(Promise<T>...promises) {

0 comments on commit 412ab68

Please sign in to comment.
Something went wrong with that request. Please try again.