Contribution:
groovyDataFlowVariables
Headline
A Groovy-based implementation that uses data flow variables
Motivation
Groovy is one of the most well-known JVM languages. One of its strength lies in the GPars , which offers many different approaches to parallel programming. An interesting concept is the concurrency based on data flow. The overall idea is the creation of a temporal order between processes, seeing the availability of certain values as constraints. This project demonstrates the usage of this data flow concurrency in Groovy using data flow variables.
Illustration
Queries like Feature:Total depends on different values (e.g. the Feature:Total of each department). Because these subqueries are independent from each other they can be executed in parallel.
In general, all subcomputations are outsourced in a new thread. Therefore, these computations are encapsulated into closures and transfered to the task method. If such a thread needs a value of a data flow variable, which is not bound (i.e. computed) yet, it is suspended until its awoken by the system. For compact programing GPars offers a container like bean, which properties are data flow variables. These variables are initialized lazily the first time they are accessed. An example for such a bean is totals.
// outsourcing total computation for each the department depts.each() { d ->
task { // adding dept's total as dataflow variable to the bean totals.putAt d.name, d.total() }
}
Architecture
- Company.groovy everything related to a company
- Department.groovy everything related to a department
- Employee.groovy everything related to an employee
- Basic.groovy basic functionality tests with a sample company
Usage
You need to install the Eclipse plugin Groovy-Eclipse. Update Site: http://dist.springsource.org/release/GRECLIPSE/e3.7/
Then open Basic.groovy and start the JUnit test case you like. The implementation has been tested with:
- Eclipse IDE (Version 3.7)
- Groovy-Eclipse: Eclipse plugin (Version 2.5.1)
- GPars: Parallel computing framework (Version 0.12)
- JUnit: Unit testing (Version 4.8.2)
There are no revisions for this page.
User contributions
User edits
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.
Syntax for editing wiki
For you are available next options:will make text bold.
will make text italic.
will make text underlined.
will make text striked.
will allow you to paste code headline into the page.
will allow you to link into the page.
will allow you to paste code with syntax highlight into the page. You will need to define used programming language.
will allow you to paste image into the page.
is list with bullets.
is list with numbers.
will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.
will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.
will allow your to insert code snippets from @worker.