ensured transactions do not interfear with other transactions. This would require a XA data source
This commit is contained in:
@ -14,6 +14,8 @@ import javax.ejb.Lock;
|
|||||||
import javax.ejb.LockType;
|
import javax.ejb.LockType;
|
||||||
import javax.ejb.Singleton;
|
import javax.ejb.Singleton;
|
||||||
import javax.ejb.Startup;
|
import javax.ejb.Startup;
|
||||||
|
import javax.ejb.TransactionAttribute;
|
||||||
|
import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
@ -84,6 +86,7 @@ public class ConfigService implements Serializable {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue) throws ConfigException {
|
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue) throws ConfigException {
|
||||||
// get configValue as usual
|
// get configValue as usual
|
||||||
String configValue = getConfigValue(configKey);
|
String configValue = getConfigValue(configKey);
|
||||||
@ -127,6 +130,7 @@ public class ConfigService implements Serializable {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue, Account account, boolean fallbackToSystem) throws ConfigException {
|
public String getConfigValue(String configKey, String defaultValue, boolean storeDefaultValue, Account account, boolean fallbackToSystem) throws ConfigException {
|
||||||
String configValue = getConfigValue(configKey, account, fallbackToSystem);
|
String configValue = getConfigValue(configKey, account, fallbackToSystem);
|
||||||
|
|
||||||
@ -145,6 +149,7 @@ public class ConfigService implements Serializable {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public boolean updateConfigValue(String configKey, String configValue) throws ConfigException {
|
public boolean updateConfigValue(String configKey, String configValue) throws ConfigException {
|
||||||
Account account = getAccount("system");
|
Account account = getAccount("system");
|
||||||
return updateConfigValue(configKey, account, configValue);
|
return updateConfigValue(configKey, account, configValue);
|
||||||
@ -152,6 +157,7 @@ public class ConfigService implements Serializable {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public boolean updateConfigValue(String configKey, String accountName, String configValue) {
|
public boolean updateConfigValue(String configKey, String accountName, String configValue) {
|
||||||
Account account = getAccount(accountName);
|
Account account = getAccount(accountName);
|
||||||
if (accountName == null) {
|
if (accountName == null) {
|
||||||
@ -166,6 +172,7 @@ public class ConfigService implements Serializable {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public boolean updateConfigValue(String configKey, Account account, String configValue) {
|
public boolean updateConfigValue(String configKey, Account account, String configValue) {
|
||||||
if ((configKey == null) || (configKey.equals("")) || (configValue == null) || (configValue.equals(""))) {
|
if ((configKey == null) || (configKey.equals("")) || (configValue == null) || (configValue.equals(""))) {
|
||||||
// null or empty key / values are not possible
|
// null or empty key / values are not possible
|
||||||
|
|||||||
Reference in New Issue
Block a user