h2. General GPars Tips

h3. Grouping

High-level concurrency concepts, like Agents, Actors or Dataflow tasks and operators can be grouped around shared thread pools.
The _PGroup_ class and its sub-classes represent convenient GPars wrappers around thread pools.
Objects created using the group's factory methods will share the group's thread pool.
{code}
def group1 = new DefaultPGroup()
def group2 = new NonDaemonPGroup()

group1.with {
    task {...}
    task {...}
    def op = operator(...) {...}
    def actor = actor{...}
    def anotherActor = group2.actor{...}  //will belong to group2
    def agent = safe(0)
}
{code}

{note}
When customizing the thread pools for groups, consider using the existing GPars implementations - the _DefaultPool_ or _ResizeablePool_ classes.
Or you may create your own implementation of the _groovyx.gpars.scheduler.Pool_ interface to pass to the _DefaultPGroup_ or _NonDaemonPGroup_ constructors.
{note}

h3. Java API

Most of GPars functionality can be used from Java just as well as from Groovy. Checkout the _2.6 Java API - Using GPars from Java_ section of the User Guide
and experiment with the maven-based stand-alone Java "demo application":http://gpars.codehaus.org/Demos .
Take GPars with you wherever you go!
