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
0
votes
0 answers

Spock mock never seems to get called when called in gpars activeobject method

In my code I have two classes, one a thing called DynamicRule, and the other a wrapper for this called AORule which provides a GPARS activeObject wrapper for a rule instance. The DynamicRule looks a bit like this - with a method called…
WILLIAM WOODMAN
  • 1,185
  • 5
  • 19
  • 36
0
votes
2 answers

GPars is part of Groovy but not in the API docs? Why can't I import?

http://www.gpars.org/guide/guide/gettingStarted.html#gettingStarted_downloadingAndInstalling It says that GPars has been incorporated into Groovy. If so, why can't I find it in the API documentation for Groovy? Why is it that my import statements…
user447607
  • 5,149
  • 13
  • 33
  • 55
0
votes
1 answer

GPars paralell write, when are all files written?

So if I have a block that looks like: def fileTree = project.fileTree("someDir/") GPars.withPool(threads,exceptionHandler) { fileTree.eachParallel { File -> //Load the file, transform the data and write it to a new file name. } //End of…
user447607
  • 5,149
  • 13
  • 33
  • 55
0
votes
2 answers

What is the simplest way to run method asynchronously and being able to see its state?

I would like to run one single long lasting operation and being able to see the following stages of it: 1) not yet ran 2) running 3) finished ok 4) finished with exception I wrote the code below, which looks excessively complex. It uses three…
Dims
  • 47,675
  • 117
  • 331
  • 600
0
votes
0 answers

What does the word "loop" mean in Actor example of GPars?

In the following HelloWorld GPars example we have the word loop: def decryptor = actor { loop { react { message -> if (message instanceof String) reply message.reverse() else stop() } } } def console…
Dims
  • 47,675
  • 117
  • 331
  • 600
0
votes
1 answer

multi-threaded website parser and out of memory problems

Hi. I'm coding a website parser that is aimed to be fast and thus multi-threaded. The external libraries I'm using are: apache HTTP client, Jsoup (for HTML parsing) and GPars (for message-driven threads). Now I'll show some concept that I'm trying…
0
votes
1 answer

Groovy Actor Behaving Strange

I have this piece of code: class GitDownloader extends DefaultActor { private String dir @Override protected void act() { loop { react { repos -> if (repos instanceof String[]) …
Trt Trt
  • 5,330
  • 13
  • 53
  • 86
0
votes
1 answer

Waiting on multiple async gpars dataflow tasks with timeout

I'm struggling to achieve a goal of having multiple async tasks that have general timeout. The trick is that I need to process whatever was received within the timeout. For example the code below gets the value of both tasks when timeout value is…
kaskelotti
  • 4,709
  • 9
  • 45
  • 72
0
votes
0 answers

Does grails 3.0.9 use Gpars or not?

I am reading this: https://grails.github.io/grails-doc/3.0.x/guide/async.html and I am trying to understand if the latest Grails is using Gpars by default. It says this: The excellent GPars project features a whole range of different APIs for…
Trt Trt
  • 5,330
  • 13
  • 53
  • 86
0
votes
1 answer

Groovy JsonBuilder appending \u0000's to string

I'm trying to make a simple UDP socket server for a Unity3D game I'm making, and I've got it mostly working. I can send messages to it and read the messages. But when I'm trying to send the message back to the client (for testing purposes, at the…
Fiberwire
  • 55
  • 1
  • 8
0
votes
2 answers

Process huge amount of data with grails and gpars

I have a Grails application which runs a job on a daily basis at midnight. In my example app I have 10000 Person records and do the following in the quartz job: package threading import static grails.async.Promises.task import static…
mmjmanders
  • 1,533
  • 2
  • 13
  • 32
0
votes
1 answer

Why GPars runForkJoin is slow even when there are no forkOffChild()?

This is the sequential version: void f(long n) { for (int i=1; i
David Bower
  • 121
  • 2
  • 10
0
votes
2 answers

How to wait for tasks to be completed by GPars Agent class?

Currently I am using GPars Agent class to process typical shopping cart scenario. I have a situation where I need to wait for addtocart, minicart tasks to complete before viewcart task returns response. The webservice call returns viewcart before…
Hari
  • 9
  • 1
  • 5
0
votes
1 answer

Actor Exception

I just want to send some messages between 2 actors in Groovy. I receive the first messages abc, but get then the following exception: An exception occurred in the Actor thread Actor Thread 1 groovy.lang.MissingPropertyException: No such property:…
Evgenij Reznik
  • 17,916
  • 39
  • 104
  • 181
0
votes
1 answer

GPars - proper way to terminate a parallel collection early

What is the best way to terminate a parallel collection (in the case of either an exception thrown by one of the threads, or an interrupt initiated by the user)? In either case, I could easily set some flag and just check it at the top of the loop. …
user1373467
  • 315
  • 3
  • 12