This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('net.code-story:http:2.98') | |
import net.codestory.http.WebServer | |
new WebServer() | |
.configure { routes -> routes.anyGet { ctx -> "Hello"} } | |
.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.atomic.LongAdder | |
import java.util.stream.IntStream | |
def frequencyMap = new ConcurrentHashMap<>() | |
def rnd = new Random() | |
IntStream.range( 0, 10000 ) | |
.parallel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.transform.* | |
import groovyx.gpars.actor.* | |
import groovyx.gpars.group.* | |
@Immutable class Calculate {} | |
@Immutable class Work { int start, nrOfElements } | |
@Immutable class Result { double value } | |
@Immutable class PiApproximation { double pi ; long duration } | |
double calculatePiFor( int start, int nrOfElements ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin:'groovy' | |
apply plugin:'idea' | |
repositories { mavenCentral() } | |
dependencies { | |
groovy 'org.codehaus.groovy:groovy-all:1.8.4' | |
} | |
task makeDirs(description:'make all dirs for project setup') << { |