0
아래와 같이 'PreVerifymanager.groovy'에 GParsPool.withPool을 구현했습니다.파이프 라인에서 호출 된 Gpars withPool 메서드
import groovyx.gpars.GParsPool
public class PreVerifyManager {
static final THREADS = 3;
public void callMe() {
PreVerifyManager pf = new PreVerifyManager()
def apps = ["App1","App2","App3"]
GParsPool.withPool(PreVerifyManager.THREADS) {
apps.eachParallel {
pf.CreateFile(it)
}
}
}
public void CreateFile(String path){
path = "D:\\"+path+".txt";
println(path)
File file = new File(path)
file.write("Some text")
}
}
이것은 내 IDE에서 PreVerifyManager의 기본 방법으로 정상적으로 작동합니다. 하지만 메인 메소드를 제거하고 파이프 라인 스크립트에서 생성 된 PreVerifyManager의 객체에 대해 callMe 메소드를 호출하면 작동하지 않습니다. 아래
파이프 라인 스크립트 :
node {
def PreVerifyManagerObj
stage 'TibcoConfig'
echo 'Reading Tibco configuration!'
println "****************INSIDE PIPELINE****************"
def parent = getClass().getClassLoader()
def loader = new GroovyClassLoader(parent)
PreVerifyManagerObj = loader.parseClass(new File("D://Tibco_Automation//src//com//meet//PreVerifyManager.groovy")).newInstance()
PreVerifyManagerObj.callMe()
}
그것은 기본적으로, 나는 파이프 라인 스크립팅과 GParsPool.withPool 구현을 통합하고있다. 모든 입력을 부탁드립니다.
해당 코드 블록이 다른 사람들을 도울 수 있습니다. – Rao