I have class with main method like:
public class Main {
public static void main(String[] args) {
long timeCheck;
long periodOfTime;
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
long initialDelay = 0; // the time from now to delay execution
long period = 1; // the period between successive executions
scheduler.scheduleAtFixedRate(new FeedReader(img, url, title, price), initialDelay, period, TimeUnit.DAYS);
...
...
}
}
and another class with some code:
public class FeedReader implements Runnable {
private String img;
private String url;
private String title;
private String price;
public FeedReader(String img, String url, String title, String price) {
this.img = img;
this.url = url;
this.title = title;
this.price = price;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
...
How to call properly via scheduleAtFixedRate method constructor with existing parameters from FeedReader class? I appreciate any help.