groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject Re: Executing Groovy DSL scripts concurrently
Date Wed, 07 Feb 2018 15:58:53 GMT
Hi Adithyan,

     How about caching the class instance and reuse it? Here are some
scratch code for your reference:

```
static LRUCache<String, Class> lruCache = new LRUCache<String, Class>(100);

def dslSrc = '''
    your DSL source code
'''
def md5 = md5(dslSrc)
def resultClass = lruCache.getAndPut(md5, k -> new GroovyShell().parse
dslSrc)  
```

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Mime
View raw message