三) Hudson.FileSystemProvisioner
此處需要實(shí)現(xiàn)序列化。并且各個(gè)slave重新下載slave.jar且重連。
discardWorkspace加入激活slave刪除文件夾的功能。
publicstaticfinalclassDefaultextendsFileSystemProvisionerimplements Serializable{
/**
publicvoidprepareWorkspace(AbstractBuild<?, ?> build, FilePath ws, TaskListener listener)throwsIOException, InterruptedException {
}
publicvoiddiscardWorkspace(AbstractProject<?, ?> project, FilePath ws)throwsIOException, InterruptedException {
//add byliangjz,遞歸刪除文件參考ZFSProvisioner
ws.act(newFileCallable<Void>(){
publicVoid invoke(File f, VirtualChannel channel)throwsIOException {
if(f!=null){
Util.deleteRecursive(f);
}
returnnull;
}
});
}