Software transactional memory
Software transactional memory is a mechanism that provides programmers transactional semantic for accessing data in memory. In this section, you will learn how to apply these elements in Groovy. Take into account that we don't make an introduction to the Groovy programming language. You can find a lot of tutorials about the Groovy programming language on the internet. The main page about GPars is http://gpars.org. You can download the library and find documentation about how to use them. As we mentioned before, you also can use this library in the Java programming language.
Using Java elements
Groovy is a programming language that generates byte codes for the JVM. You can use all the elements of the Java programming language in a Groovy program, including all those elements related with concurrency.
For example, in the following example you're going to create a Thread
. First, declare a Groovy class named Example1
with a main()
method:
class Example1 { static...