Fix for property types not properly initialized on startup.
@@ -99,6 +99,7 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
public void postConstruct() {
logger.debug("postConstruct {" + bundleContext.getBundle() + "}");
+ loadPropertyTypesFromPersistence();
processBundleStartup(bundleContext);
for (Bundle bundle : bundleContext.getBundles()) {
if (bundle.getBundleContext() != null) {
@@ -154,6 +155,14 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
TimerTask task = new TimerTask() {
@Override
public void run() {
+ loadPropertyTypesFromPersistence();
+ }
+ };
+ allPropertyTypesTimer.scheduleAtFixedRate(task, 5000, 5000);
+ logger.info("Scheduled task for property type loading each 5s");
+ }
+
+ private void loadPropertyTypesFromPersistence() {
try {
allPropertyTypes = persistenceService.getAllItems(PropertyType.class, 0, -1, "rank").getList();
Map<String,PropertyType> newPropertyTypesById = new HashMap<>();
@@ -178,10 +187,6 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
logger.error("Error loading property types from persistence service", e);
}
}
- };
- allPropertyTypesTimer.scheduleAtFixedRate(task, 0, 5000);
- logger.info("Scheduled task for property type loading each 5s");
- }
private void updateListMap(Map<String, List<PropertyType>> listMap, PropertyType propertyType, String key) {
List<PropertyType> propertyTypes = listMap.get(key);
