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

Groovy GPars, need index for each thread launched

Using GPars with Groovy, I launch 3 threads to do some work in parallel... GParsPool.withPool(3){ result = myList.collectParallel{ processItem(it) } } This works fine, but I need an index in the closure that represents the thread…
raffian
  • 31,267
  • 26
  • 103
  • 174
2
votes
1 answer

eachParallel() throwing groovy.lang.MissingMethodException when using GPars

I'm currently trying to use GPars to concurrently go through a directory system in a DFS manner. This is what I have so far: ArrayList visited = Collections.synchronizedList(new ArrayList()) void scheduleDirectory(String…
sparkhee93
  • 1,381
  • 3
  • 21
  • 30
2
votes
1 answer

How to collect data from parallel running tasks using GPars and Groovy

GPars documentation says we should not do: def thumbnails = [] images.eachParallel {thumbnails << it.thumbnail} // Concurrently accessing a not-thread-safe collection of thumbnails? Don't do this! source:…
Rax
  • 563
  • 1
  • 3
  • 17
2
votes
1 answer

GParse call BackendService async

I'm trying to implement asynchronism in the backend calls, I've been reading and it seems that GParse is a good library to implement this, but it's not clear to me how i can implement this in a correct way. Can anyone help me? This is my example: …
JpCrow
  • 4,881
  • 4
  • 32
  • 46
2
votes
1 answer

NullPointerException in GPars, Actor

Groovy: 1.8.6 GPars: 0.12 or 1.2.1 OS: Ubuntu 14.04 LTS @Grab(group='org.codehaus.gpars', module='gpars', version='0.12') import groovyx.gpars.actor.Actor import groovyx.gpars.actor.Actors def a = 1 def b = 100000 def reactor2 = Actors.reactor…
2
votes
1 answer

GPars syntax unfamiliar

I'm coming from a Java background and I'm stuck learning Groovy and Gradle at the same time, since my purpose for one is the other. :-/ I'm also in need of the GPars stuff since speed and parallelism are an issue. Anyway, I see this GPars example…
user447607
  • 5,149
  • 13
  • 33
  • 55
2
votes
0 answers

Hibernate into a GPars pool

I am trying to find an object (instance of Worker) but it is not retreived inside a Gpars pool. List responsables = Responsable.list() withPool(20) { responsables.eachParallel { Responsable responsable -> …
quindimildev
  • 1,280
  • 8
  • 21
2
votes
2 answers

How can I guarantee order of execution/presentation of tasks in GPars threadpool?

I'm running a set of tasks using a Gpars thread pool. The task execution times are very variable, from a few seconds to 20 minutes. (These are cucumber feature files FWIW.) As luck would have it, the last task in the features list takes the longest…
Nic
  • 1,518
  • 12
  • 26
2
votes
0 answers

Concurrent Requests with HtmlUnit

Here's my code: def search = {item-> def url = "http://localhost:8080/search/"+item println 'url='+ url page = webClient.getPage(url); println 'pageURL=' + page.url } GParsPool.withPool(5) { searchList.each {item->…
2
votes
2 answers

Groovy/Grails promises/futures. There is no .resolve(1,2,3) method. Strange?

I am developing in a Grails application. What I want to do is to lock the request/response, create a promise, and let someone else resolve it, that is somewhere else in the code, and then flush the response. What I find really strange is that the…
mjs
  • 21,431
  • 31
  • 118
  • 200
2
votes
1 answer

collecting results asynchronously from gpars parallel executor

We've got some code in Java using ThreadPoolExecutor and CompletionService. Tasks are submitted in large batches to the pool; results go to the completion service where we collect completed tasks when available without waiting for the entire batch…
raffian
  • 31,267
  • 26
  • 103
  • 174
2
votes
1 answer

Are messages send to gpars actors copied or referenced?

Are messages send to gpars actors copied or referenced? If I send a buffered output stream containing binary data, it's referenced right, or is it copied? How does strings or other kind of data work? Is there some kind of message queues for the…
user235273
2
votes
1 answer

Fork/Join calculation

I have this example of a fork/join calculation. Could somebody please describe me shortly how it works here? def quicksortForkJoin(numbers) { withPool { runForkJoin(0, numbers) {index, list -> def groups = list.groupBy {it…
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
2
votes
1 answer

Set task or pool priority in Gpars

I have a few tasks that should be executed with different priorities. For example, task A is need as soon as possible, but tasks B and C may be calculated a bit later, but definitely after task A. Moreover, priority of tasks B or C may be changed in…
Kipriz
  • 335
  • 1
  • 10
2
votes
1 answer

Gpars withExistingPool Error jsr166y.ForkJoinPool not found

I have updated from 'org.codehaus.gpars:gpars:1.0.0' to 'org.codehaus.gpars:gpars:1.1.0'. My code works fine in 1.0.0 but in version 1.1.0 I cannot find jsr166y.ForkJoinPool anymore. How do I get the correct ForkJoinPool? The code I am using is:…
Michael
  • 32,527
  • 49
  • 210
  • 370