Dehydrating long running Groovy DSLs

In my recent article about Domain Specific Languages (DSLs) published in the 12/2009 issue of Javamagazin I described how to implement DSLs using Groovy.
In the article I mentioned that dehydration (state persistence) could be added to the DSL runtime if needed to support long running processes.
I’ve created a Groovy script dehydration.groovy to illustrate how this could be achieved.
Basically the Groovy script is stopped by terminating the executing thread and the state is pulled out.
Later on the state is injected and the remaining part of the script is executed.
This approach can be used to process any kind of long running scripts, especially if they have to wait for external events.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>