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
2
votes
1 answer

GPars: Waiting for actors to finish

I think I got this wrong from the docs. I have two actors, XMLActor and HttpActor. XMLActor reads xmlFiles and then sends a message to HTTPActor to process. XMLActor will finish way sooner than HttpActor. My main class calls join on both actors. I…
Vinicius Carvalho
  • 3,994
  • 4
  • 23
  • 29
2
votes
2 answers

Data Parallelism with GPars

I found this example here Data Parallelism GParsPool.withPool() { Closure longLastingCalculation = {calculate()} Closure fastCalculation = longLastingCalculation.async() Future result=fastCalculation() //do stuff while calculation…
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
2
votes
1 answer

Parallel with withPool

I found an example on how to use withPool. It says I just need to add the word Parallel to Groovy's methods like collect, find, each, put it into withPool and it executes the code parallel. import static groovyx.gpars.GParsPool.withPool list =…
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
2
votes
1 answer

Trying to use GPars with IntelliJ and grails

I have been having a lot of trouble using an external JAR, GPars, in an IntelliJ Grails project. I think it is a problem with specifying the dependency. I am using GPars-1.0.0. I saved it in the lib directory and included it as a dependency using…
Alison
  • 5,630
  • 4
  • 18
  • 26
2
votes
2 answers

GPars report status on large number of async functions and wait for completion

I have a parser, and after gathering the data for a row, I want to fire an aync function and let it process the row, while the main thread continues on and gets the next row. I've seen this post: How do I execute two tasks simultaneously and wait…
user1373467
  • 315
  • 3
  • 12
2
votes
1 answer

GORM GPARS Integration Test

I am trying to integration-test the Gorm pessimistic lock, and simulating with multithreading the access from many servers simultaneously, but in each thread I don't get the results expected. This is my code: @Test void testLockInBetweenCheck()…
acurs
  • 41
  • 5
2
votes
2 answers

What is the significance of "loop()" method in Actors body - GPars

In Actors body we need to write react() method inside loop() method. I want to know how this loop method is different from "for" or "while" loop? GPars documentation says "loop() cooperates with nested react() blocks and will ensure looping across…
Gagan Agrawal
  • 139
  • 1
  • 9
2
votes
1 answer

How can I get IntelliJ IDEA to recognize the GPars DSL?

According to the GPars User Guide, IntelliJ IDEA is supposed to be able to recognize the GPars DSL right out of the box as soon as the GPars jar is added to the project. Since Groovy 1.8, GPars is now included in the Groovy distribution, but adding…
cdeszaq
  • 30,869
  • 25
  • 117
  • 173
2
votes
2 answers

Why DataFlow variables can only be assigned once

I am exploring GPars(Groovy Parallel System) library these days and I came across DataFlow variables. The documentation says Dataflow variables can only be assigned once. However I could not find a reason for this restriction. Can somebody tell me…
Gagan Agrawal
  • 139
  • 1
  • 9
1
vote
1 answer

GPars with Groovy, when is explicit synchronization required with collectParallel()?

Assume the following parallel process in Groovy/Gpars.... def result GParsPool.withPool(5){ result = idList.collectParallel{processItem(it)} } If result is just an array list, and, assuming no thread accesses or manipulates result in…
raffian
  • 31,267
  • 26
  • 103
  • 174
1
vote
1 answer

gpars withExistingPool

I am trying to use gpars GParsPool.withExistingPool in gpars 0.12 It expects a jsr166y.ForkJoinPool but looks like in the jsr166y jar I have, there is no way to create that class(?). The only ones I can create are jsr166y.forkjoin.ForkJoinPool like…
Eqbal
  • 4,722
  • 12
  • 38
  • 47
1
vote
0 answers

Indexing an entity in an actor thread using Grails searchable

I am using the Grails searchable plugin to index an entity with a custom text representation. I want this entity to be indexed in an actor (using GPars) that will be triggered asynchronously once the entity was inserted. Is there any way to realize…
1
vote
1 answer

Grails GPARS upgrade

I am using Grails 1.4.0.M1 and I am trying to upgrade the version of gpars to use with my app. So I added in BuildConfig.groovy: dependencies{ build 'org.codehaus.gpars:gpars:0.11' } This however brings me the following exception when I use…
Philippe
  • 446
  • 2
  • 12
1
vote
2 answers

Grails + Gpars.memoize().. how to do memoization?

I can't seem to figure out how to do memoization in Grails. According to the GPars docs it should be as simple as def c = { x -> x*2 }.memoize() or ... .gmemoize() But all i seem to get is compilation errors and stacktraces thrown. Has anyone…
netbrain
  • 9,194
  • 6
  • 42
  • 68
1
vote
1 answer

ConcurrentException/NullPointerException in GParsPool runForkJoin

For a little context, i'm trying to solve Project Euler problem 31 using excellent GParsPool Fork/Join support. For that, i've written the foolowing code : import groovyx.gpars.* import…
Riduidel
  • 22,052
  • 14
  • 85
  • 185