FileJobBean super class 변경

master
mjkhan21 1 year ago
parent 7c136b90bf
commit 1a08178bd0

@ -11,15 +11,13 @@ import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Stream;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.component.ScheduledBean;
import cokr.xit.interfaces.filejob.JobConf;
/** Bean
* @author mjkhan
*/
public abstract class FileJobBean extends AbstractComponent {
private boolean busy;
public abstract class FileJobBean extends ScheduledBean {
/** Bean .<br />
* {@link JobConf} Bean .
* @return
@ -33,28 +31,6 @@ public abstract class FileJobBean extends AbstractComponent {
return JobConf.get();
}
/** Bean .<br />
* {@link FileJobServiceBean} .
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean isBusy() {
return busy;
}
/** Bean .<br />
* {@link FileJobServiceBean} .
* @param busy
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public void setBusy(boolean busy) {
this.busy = busy;
}
/**
* @author mjkhan
*/

@ -1,41 +0,0 @@
package cokr.xit.interfaces.filejob.service.bean;
import java.util.function.Supplier;
import cokr.xit.foundation.component.AbstractServiceBean;
/** , /
* @author mjkhan
*/
public class FileJobServiceBean extends AbstractServiceBean {
/** . fileJob .
* @param fileJob Bean
* @param task Bean
*/
protected void execute(FileJobBean fileJob, Runnable task) {
if (fileJob.isBusy()) return;
fileJob.setBusy(true);
try {
task.run();
} finally {
fileJob.setBusy(false);
}
}
/** . fileJob null .
* @param fileJob Bean
* @param task Bean
* @return
*/
protected <T> T execute(FileJobBean fileJob, Supplier<T> task) {
if (fileJob.isBusy()) return null;
fileJob.setBusy(true);
try {
return task.get();
} finally {
fileJob.setBusy(false);
}
}
}
Loading…
Cancel
Save