optimized startup sequence

This commit is contained in:
2018-11-15 10:54:34 +01:00
parent 6f5baaaa69
commit 389e3a6a73
8 changed files with 195 additions and 128 deletions

View File

@ -38,6 +38,7 @@ import org.hibernate.annotations.Type;
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "AccountEntity.findAll", query = "SELECT a FROM AccountEntity a ORDER by a.lastname, a.firstname"),
@NamedQuery(name = "AccountEntity.findByUsername", query = "SELECT a FROM AccountEntity a WHERE a.username = :username"),
@NamedQuery(name = "AccountEntity.findByStatus", query = "SELECT a FROM AccountEntity a WHERE a.status = :status"),
@NamedQuery(name = "AccountEntity.findByCreatedOn", query = "SELECT a FROM AccountEntity a WHERE a.createdOn = :createdOn"),
@NamedQuery(name = "AccountEntity.findByCreatedBy", query = "SELECT a FROM AccountEntity a WHERE a.createdBy = :createdBy"),

View File

@ -9,7 +9,6 @@ import de.muehlencord.shared.account.business.config.entity.ConfigException;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
import javax.annotation.PostConstruct;
import javax.ejb.Lock;
import javax.ejb.LockType;
import javax.ejb.Singleton;
@ -81,6 +80,8 @@ public class ConfigService implements Serializable {
return getConfigValue(configKey, defaultValue, false);
}
@Transactional
@Lock(LockType.WRITE)
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue) throws ConfigException {
// get configValue as usual
String configValue = getConfigValue(configKey);
@ -121,6 +122,8 @@ public class ConfigService implements Serializable {
}
}
@Transactional
@Lock(LockType.WRITE)
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue, Account account, boolean fallbackToSystem) throws ConfigException {
String configValue = getConfigValue(configKey, account, fallbackToSystem);