三) Hudson.FileSystemProvisioner
此处需要实现序列化。并且各个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;
}
});
}