bug5322: After callback with Thomas I changed the fixed thread pool to one of the ThreadPoolUtils to take care for e.g. local thread issues of this application.

- fixed a potential NullPointerException in LegColumn
This commit is contained in:
Udo Wessels
2020-09-07 15:33:08 +02:00
parent 1f09608c82
commit d7fa3f919b
3 changed files with 8 additions and 3 deletions
@@ -8,5 +8,6 @@ Bundle-Vendor: SAP
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: com.sap.sailing.domain.common,
com.sap.sse.common
com.sap.sse.common,
com.sap.sse
Export-Package: com.sap.sailing.declination
@@ -5,6 +5,7 @@ import java.text.ParseException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
@@ -17,6 +18,8 @@ import org.xml.sax.SAXException;
import com.sap.sailing.declination.Declination;
import com.sap.sailing.domain.common.Position;
import com.sap.sse.common.TimePoint;
import com.sap.sse.util.ThreadPoolUtil;
import com.sap.sse.util.impl.ThreadPoolUtilImpl;
public abstract class DeclinationImporter {
private static final Logger logger = Logger.getLogger(DeclinationImporter.class.getName());
@@ -38,7 +41,8 @@ public abstract class DeclinationImporter {
*/
public Declination getDeclination(final Position position, final TimePoint timePoint,
long timeoutForOnlineFetchInMilliseconds) throws IOException, ParseException {
ExecutorService executorService = Executors.newFixedThreadPool(1);
ExecutorService executorService = ThreadPoolUtil.INSTANCE.
createBackgroundTaskThreadPoolExecutor(1, "DeclinationImporterThreadPoolExecutor");
try {
return executorService.submit(
() -> importRecord(position, timePoint)
@@ -491,7 +491,7 @@ public class LegColumn extends ExpandableSortableColumn<String> {
LegEntryDTO legEntry = getLegEntry(row);
if (legEntry != null && legEntry.rank != 0) {
return ""+legEntry.rank;
} else if (leaderboardEntryDTO.legDetails != null && legIndex+1 > leaderboardEntryDTO.legDetails.size()) {
} else if (leaderboardEntryDTO != null && leaderboardEntryDTO.legDetails != null && legIndex+1 > leaderboardEntryDTO.legDetails.size()) {
return "n/a";
} else {
return "";