concept thread in category groovy

This is an excerpt from Manning's book Groovy in Action, Second Edition.
Groovy internally stores the most recently used matcher (per thread). It can be retrieved with the static property Matcher.lastMatcher. You can also set the index property of a matcher to make it look at the respective match with matcher.index = x. Both can be useful in some exotic corner cases. See Matcher’s API documentation for details.
One of Java’s merits is its great support for multithreading. The Java platform provides various means for scheduling and executing threads of control efficiently, whereas the Java language allows easy definition of Runnable objects for multithreaded execution and control by wait/notify schemes and the synchronized keyword.
Threads are useful for organizing execution flow inside an application. Processes, in contrast, deal with functionality outside your Java or Groovy application. They cannot share objects but need to communicate via streams or other external means. They often appear in Groovy automation scripts, because by nature, such scripts trigger machine-dependent functionality.
The GDK supports working with threads and processes by introducing new Groovy-friendly methods for these classes, as you’ll see in the following sections. For the remainder of this section, it’s assumed that you have some basic understanding of Java’s multithreading. It’s useful to look at the API documentation of java.lang.Thread and java.lang.Process.