Monday, March 31, 2008

Groovy Threads

I don't know why I think this is so cool, because it's such a no-brainer, but I really like the way Groovy added closures to the Thread class:

tmp.groovy:

def stringOne = 'Hello, ';
def stringTwo = 'World!';
Thread.start{sleep(1000); println stringTwo}
Thread.start{sleep(999); print stringOne}

Tuesday, March 11, 2008

Groovy Classpath

I always forget this, so it's getting added to my blog for further reference:

You can place jars in your ${user.home}/.groovy/lib directory to have them automatically loaded into your classpath.