Questions tagged [gpars]

The GPars project offers developers new intuitive and safe ways to handle Java or Groovy tasks concurrently, asynchronously, and distributed by utilizing the power of the Java platform and the flexibility of the Groovy language.

The GPars project is a concurrency framework for Groovy and Java. It provides the following abstraction layers over traditional multi-threading / parallel programming

  • Concurrent collection processing
  • Asynchronous operations
  • Fork/Join abstraction
  • Actor programming model
  • Dataflow concurrency constructs
  • Agent - an thread-safe reference to mutable state
114 questions
10
votes
2 answers

Grails, GPars and data persistence

Something is not getting flushed. A simplified example of what's happening: def testDemo() { def person = new Person(...) person.save(flush: true) println "Number of people after save: " + Person.all.size() def dummyList = [1, 2,…
Alison
  • 5,630
  • 4
  • 18
  • 26
9
votes
2 answers

What is the GPars default pool size?

I thought this would have been an easy thing to find but I've failed. If I use GPars in my Groovy application and I don't specify a pool size how many threads will be created? Is there a default pool size without setting one? // How many threads…
C0deAttack
  • 24,419
  • 18
  • 73
  • 81
7
votes
4 answers

Is Cucumber-jvm thread safe?

I want to run the same Cucumber tests in multiple threads. More specifically, I have a set of features, and running these features in one thread works fine. I use the JSON formatter to record running time of each step. Now I want to do load test. I…
fhcat
  • 971
  • 2
  • 9
  • 28
7
votes
1 answer

Groovy (GPars) and MissingMethodException when calling eachParallel()

When I run the following code in the console (groovy 2.1.3): strings = [ "butter", "bread", "dragon", "table" ] strings.eachParallel{println "$it0"} I get: groovy.lang.MissingMethodException: No signature of method:…
Armin
  • 1,367
  • 1
  • 12
  • 17
7
votes
2 answers

Groovy/Grails GPARS: How to execute 2 calculations parallel?

I'm new to the GPARS-library and implementing it in our software at the moment. It's no problem for me to use it instead of the normal groovy-methods like [..].each{..} -> [..].eachParallel{..} But I'm wondering how to parallelize 2 tasks which…
Martin L.
  • 3,006
  • 6
  • 36
  • 60
6
votes
1 answer

GPars: return of eachParallel{}

I want to do alot of stuff with each of those example strings and return Object of some other type here Integers, later some bigger class-objects. Here in this example I am trying something simple, how ever I get a completly wrong result. At least…
Jakunar
  • 156
  • 1
  • 2
  • 7
6
votes
1 answer

How do I execute two tasks simultaneously and wait for the results in Groovy?

I have a large processing task which I believe is ripe for being made more efficient with concurrency and parallelism. I had a look at the GPars docs and I found them quite confusing so I hope people here can help. The first task I would like to do…
FinalFive
  • 1,465
  • 2
  • 18
  • 33
4
votes
1 answer

grails 2.3.x async and sleep

I got some strange behaviour using grails 2.3.x and async. I'm doing some test with this code: def test1() { def list = new PromiseList() list << { Thread.sleep(1000) println "1" return "1" } list << { …
Tamer
  • 41
  • 1
  • 6
4
votes
1 answer

Are GPars Actors fault tolerant

Actors in GPars have their own message queue (mail box). Say an actor is having 15 pending messages and suddenly system goes down(say due to power failure). What will happen to those 15 messages. Will the message queue be restored automatically when…
Gagan Agrawal
  • 139
  • 1
  • 9
3
votes
1 answer

Uploading files in parallel with Java FTP client

I was using GPars to upload files in a parallel manner with ftp4j client library as: GParsPool.withPool { files.eachParallel { file -> ftpClient.upload(directory, stream) } But, now I only have server ELB address for which ftp4j client…
Yogen Rai
  • 2,961
  • 3
  • 25
  • 37
3
votes
0 answers

Running async method in groovy

In Grails service, I would like to render a page while another method is running asynchronously. I tried different things from the documentation async and gpars library. None of the listed things worked as desired. GParsPool.withPool(2) { …
Etibar - a tea bar
  • 1,912
  • 3
  • 17
  • 30
3
votes
1 answer

Is there a way to run delayed or scheduled task with GPars?

I'm building my concurrent application on top of GPars library. It contains a thread pool under the hood, so I would like to solve all concurrency-related tasks by means of this pool. I need to run a task with a certain delay (e.g. 30 seconds). Also…
Roman
  • 64,384
  • 92
  • 238
  • 332
3
votes
1 answer

How do I parallelize GPars Actors?

My understanding of GPars Actors may be off so please correct me if I'm wrong. I have a Groovy app that polls a web service for jobs. When one or more jobs are found it sends each job to a DynamicDispatchActor I've created, and the job is handled.…
Patrick McDaniel
  • 1,073
  • 4
  • 11
  • 28
3
votes
1 answer

Fork/Join example with GPars

I found an example for fork/join in GPars here: Fork/Join import static groovyx.gpars.GParsPool.runForkJoin import static groovyx.gpars.GParsPool.withPool withPool() { println """Number of files: ${ runForkJoin(new File("./src")) {file…
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
3
votes
1 answer

GPars lock returning null

When I try to lock a line in my table, sometimes null is returned. What does that mean? I verify that the domain instance was not null before the lock: println state state = State.lock(state.id) println state This outputs: State 1 null ("State…
Alison
  • 5,630
  • 4
  • 18
  • 26
1
2 3 4 5 6 7 8