åæ£Groovyç°å¢
Hudsonã®åæ£ãã«ãã®å®è£ ã®èã«ãªã£ã¦ããã®ã¯ãã¯ãã¼ã¸ã£ããªã¢ã¼ãJVMã§å®è¡ããã¨ããä»çµã¿ãã¯ã©ã¹ãã¡ã¤ã«ã¨ããªã½ã¼ã¹ã¨ããå¿ è¦ã«å¿ãã¦ãªã¢ã¼ãJVMã«ã³ãã¼ããã®ã§ããªã¢ã¼ãå´ã«ãããããããã°ã©ã ãé åãã¦ããå¿ è¦ããªãã®ãããç¹ã§ãã
ãã¦ã常ã Javaã®ã¯ãã¼ã¸ã£ï¼ãã©ãï¼ã®ææ³ã¯åé·ã ã¨æã£ã¦ããã®ã§ãããã«Groovyãçµã¿åããããããããããªãï¼ãã¨ããäºã§ãå®é¨ãã¦è¦ãã¨ããæå¤ã«ãã¾ãããã¾ããã
def pid() { // PIDãåå¾ãããè¦ã¯ã©ã®JVMã§åãã¦ããããããããããããã ã return new File("/proc/self").canonicalPath } i=0 (0..<4).each { i++; remote { println "1st from ${pid()} (${i})" remote { println "2nd from ${pid()} (${i})" } } println "3rd from ${pid()} (${i})" }
remote {...}ãã¯ãã¼ã¸ã£ãå¥ãªJVMã«é£ã°ãã¦ããã¨ããã§ãããã®ã¯ãã¼ã¸ã£ã¯å¥JVMã§å®è¡ããã¾ããããã®æã«ã¡ããã¨èªåã®ç°å¢ãæã£ã¦ããã®ã§ãå®è¡çµæã¯æ¬¡ã®ããã«ãªãã¾ãã
1st from /proc/15502 (1) 2nd from /proc/15487 (1) 3rd from /proc/15487 (1) 1st from /proc/15502 (2) 2nd from /proc/15487 (2) 3rd from /proc/15487 (2) ...
pid=15487ã¨pid=15502ã®ï¼ã¤ã®JVMã®éãè¡ã£ããæ¥ãããã¦ããæ§åã確èªã§ãã¾ãã
ããã使ã£ã¦è¤æ°ã®ãã·ã³ã«è·¨ãã£ã¦ãã¹ãã ã®ç®¡çã ã®ãããåæ£ã¹ã¯ãªããè¨èªãä½ã£ã¦è¦ãããã¨æã£ã¦ã¾ããDSLã£ã½ããã¦Capistranoã¿ããã«ãããã¨ãã