Message-ID: <1381267214.4779.1369467356847.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4778_1918851859.1369467356847" ------=_Part_4778_1918851859.1369467356847 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Using the Groovy Fast Track you will start experimenting with GP= ars in about 3 minutes. We assume you have Groovy installed on your system.=
Start fresh Groovy Console or open up an empt= y groovy script source in your favorite IDE
Note: GPars comes= bundled with Groovy 1.8.x so this step is only requited if you are using a= n older version of Groovy.
We'll use Groovy's Grape functionaity= to grab all the requited dependencies for us. You may check ot the GPars Integration page for alternative = ways to integrate GPars with your project.
Add the following line to = the groovy script:
Believe it or not, now, we're ready to experiment. Try the following scrip= t, which will concurrently query a collection of strings with regular expre= ssions:
Run the script and you should get the following output:<= div class=3D"code panel" style=3D"border-width: 1px;">
Found an= ant Some animals can live without an a=09=09
Now feel free to experiment changing the regular expressions= , using different collections or different methods, like eachParallel(), co= llectParallel(), maxParallel(), sumParallel() and others. You get the idea,= right?
To find out more about parallel collection processing, visit = the Parallel Colections section of the User Guide.
Now we could t= ry to build an actor and send it a couple of messages to see it acting.=
Our actor maintains a private counter and accepts different = types of messages, which result in updating the counter. Sending a null val= ue will make the actor reply the current counter value back to us. Notice t= he send() method name is optional and can be replaced by the &= lt;< operator or ommited altogether.
The=C2=A0Actor section of the User Guide will help= you dive deeper into GPars actors.
Now when you have GPars runing on your system, the= time is up you opened up the User Guide, browsed the GPars code examples and continued experimenting. You may also consider checking out the Java Fast Track, in case you need= to use GPars high-level concurency abstractions from Java code. Good luck!=------=_Part_4778_1918851859.1369467356847--