
com.github.xingfudeshi.yoyo.task.CheckLockTask Maven / Gradle / Ivy
The newest version!
package com.github.xingfudeshi.yoyo.task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Objects;
import java.util.concurrent.Callable;
/**
* check the lock file ,will return true when the lock file created
* @author Wu
* @since 1.0.0
*/
public class CheckLockTask implements Callable {
private Logger logger = LoggerFactory.getLogger(getClass());
private String lock;
public CheckLockTask(String lock){
this.lock=lock;
}
@Override
public Boolean call() throws Exception {
logger.info("start checking lock task for:{}",lock);
File lockFile=new File(this.lock);
while(true){
if(Objects.nonNull(lockFile)&&lockFile.exists()){
break;
}
Thread.sleep(2000);
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy