|
|
|
@ -23,15 +23,14 @@ public class DataStoreBot {
|
|
|
|
|
}
|
|
|
|
|
public void setInterval(int seconds) {
|
|
|
|
|
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
|
|
|
|
|
ses.schedule(()->{
|
|
|
|
|
ses.scheduleAtFixedRate(()->{
|
|
|
|
|
try {
|
|
|
|
|
this.setInterval(seconds);
|
|
|
|
|
this.storeLatestEntry();
|
|
|
|
|
} catch (IOException | ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}, seconds, TimeUnit.SECONDS);
|
|
|
|
|
ses.shutdown();
|
|
|
|
|
}, 0, seconds, TimeUnit.SECONDS);
|
|
|
|
|
//ses.shutdown();
|
|
|
|
|
}
|
|
|
|
|
public Runnable storeLatestEntry() throws IOException, ParseException {
|
|
|
|
|
JSONArray APIData = this.api.getJSONObject();
|
|
|
|
|