}, {
"attribute" : "クール",
"name" : "Drastic Melody",
- "difficulty" : "MASTER+",
+ "difficulty" : "ⓁMASTER+",
"level" : 29,
"notes" : 926,
- "albumType" : "Not-implemented"
+ "albumType" : "ALBUM B"
}, {
"attribute" : "キュート",
"name" : "いとしーさー♥",
"level" : 16,
"notes" : 405,
"albumType" : "Not-Implemented"
+ }, {
+ "attribute" : "クール",
+ "name" : "Drastic Melody",
+ "difficulty" : "MASTER+",
+ "level" : 29,
+ "notes" : 934,
+ "albumType" : "ALBUM B"
+ }, {
+ "attribute" : "全タイプ",
+ "name" : "夕映えプレゼント",
+ "difficulty" : "MASTER+",
+ "level" : 29,
+ "notes" : 887,
+ "albumType" : "ALBUM B"
} ]
}
\ No newline at end of file
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.function.BiConsumer;
this.logger.info("Checking database updates...");
CompletableFuture<ArrayList<Song>> webData = CompletableFuture.supplyAsync(Scraping::getWholeData, this.executor);
CompletableFuture<ArrayList<Song>> localData = CompletableFuture.supplyAsync(Scraping::getFromJson, this.executor);
- try {
- this.updateConsumer.accept(webData.get(), localData.get());
- } catch (InterruptedException | ExecutionException e) {
- this.logger.warn("Update failed.", e);
- }
- flag = true;
+ CompletableFuture<Void> afterUpdateFuture = webData.thenAcceptBothAsync(localData, this.updateConsumer, this.executor);
+ afterUpdateFuture.whenCompleteAsync((ret, e) -> {
+ if(e != null) {
+ this.logger.warn("Manual update process has been ended with exception.", e);
+ } else {
+ this.logger.info("Manual update process has been ended successfully.");
+ flag = true;
+ }
+
+ }, this.executor);
}
public boolean getFlag() {
};
Runnable setEnabled = () -> {
try {
- Thread.sleep(1000);
+ Thread.sleep(3 * 1000L);
} catch (InterruptedException e1) {
this.logger.error("Thread has been interrupted during waiting cooldown.", e1);
}
this.btnManualUpdate = new JButton(Messages.MSGManualUpdate.toString());
this.btnManualUpdate.addActionListener(e -> {
this.impl = new ManualUpdateThreadImpl();
- this.manualUpdateThread = new Thread(this.impl);
- this.manualUpdateThread.setName("ManualUpdate-thread");
- this.manualUpdateThread.setDaemon(false);
- this.manualUpdateThread.start();
+ es.submit(this.impl);
});
this.panelEast.add(this.btnManualUpdate, "1, 9");
this.panelEast.add(this.btnTwitterIntegration, "1, 11");
this.btnExit = new JButton(Messages.MSGTerminate.toString());
this.btnExit.addActionListener(e -> {
if(DelesteRandomSelector.this.softwareUpdateFuture.isDone() || DelesteRandomSelector.this.albumTypeEstimateFuture.isDone() || !this.impl.getFlag()) {
- DelesteRandomSelector.this.logger.info("Requested Exit by Button");
+ DelesteRandomSelector.this.logger.info("Requested Exit by Button.");
+ this.logger.info("Shut down thread pool.");
+ es.shutdown();
System.exit(0);
} else {
JOptionPane.showMessageDialog(null, Messages.MSGInternalYpdateNotDoneYet.toString());