Compare commits
2 Commits
5aa1b409f2
...
e104fae66f
Author | SHA1 | Date | |
---|---|---|---|
e104fae66f | |||
24eec0621d |
@ -23,15 +23,14 @@ public class DataStoreBot {
|
|||||||
}
|
}
|
||||||
public void setInterval(int seconds) {
|
public void setInterval(int seconds) {
|
||||||
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
|
||||||
ses.schedule(()->{
|
ses.scheduleAtFixedRate(()->{
|
||||||
try {
|
try {
|
||||||
this.setInterval(seconds);
|
|
||||||
this.storeLatestEntry();
|
this.storeLatestEntry();
|
||||||
} catch (IOException | ParseException e) {
|
} catch (IOException | ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}, seconds, TimeUnit.SECONDS);
|
}, 0, seconds, TimeUnit.SECONDS);
|
||||||
ses.shutdown();
|
//ses.shutdown();
|
||||||
}
|
}
|
||||||
public Runnable storeLatestEntry() throws IOException, ParseException {
|
public Runnable storeLatestEntry() throws IOException, ParseException {
|
||||||
JSONArray APIData = this.api.getJSONObject();
|
JSONArray APIData = this.api.getJSONObject();
|
||||||
|
Loading…
Reference in New Issue
Block a user