Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 

README

A groovy library/dsl for using clojure's STM in groovy/grails applications.
this is just a thin layer of syntactic sugar on top of the java objects that implement the clojure language.
Not all concepts implemented here map exactly the their clojure namesakes.

Note, it is highly recommended that you understand how to use the objects in clojure first

This library is intended to be a vessel to sneak clojure.jar into your enterprise applications.
See Neal Ford's master plan for enterprise mindshare at 
http://blip.tv/clojure/neal-ford-neal-s-master-plan-for-clojure-enterprise-mindshare-domination-5953926

Once you get used to the joy of coding your concurrency using this model, silently switch your 
groovy scripts over to clj and enjoy the rest

See Dr. Venkat Subramaniam's materials from his "Taming Shared Mutability with STM" at http://agiledeveloper.com/downloads.html for examples and concepts in using clojure STM from Java


Example usage:

import clojure.lang.Ref
import static groovystm.STM.doSync
import static groovystm.STM.alter

class MyStateClass {
    /** Make sure your Ref's wrap immutable objects - try out clojure.lang.PersistentHashMap for example */
    Ref balanceRef = new Ref(0)

    int deposit(int amt) {
        doSync {
            alter(balanceRef) { balance -> balance + amt }
        }
    }

    int currentBalance() {
        deref(balanceRef)
    }
}

About

No description, website, or topics provided.

Resources

Releases

No releases published

Languages

You can’t perform that action at this time.