net.intelie.pipes.time.TaskAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes.time;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public class TaskAction {
private final long begin;
private final long end;
private final Task task;
public TaskAction(long begin, long end, Task task) {
this.begin = begin;
this.end = end;
this.task = task;
}
public void execute() {
try {
task.run(begin, end);
} catch (Throwable e) {
LogRecord log = new LogRecord(Level.WARNING, "Uncaught exception at {0}");
log.setParameters(new Object[]{this});
log.setThrown(e);
Logger.getLogger(TaskAction.class.getName()).log(log);
}
}
@Override
public String toString() {
return "TaskAction{" +
"begin=" + begin +
", end=" + end +
", task=" + task +
'}';
}
}