mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.3) to HEAD (5.1) (PARTIAL MERGE)
110088: Merged 5.0.2 (5.0.2) to 5.0.N (5.0.3) 110052: MNT-14579: TS starting in read-only mode after applying 5.0.2 build 64 - This intermittent issue was probably caused by the SysAdminParams.afterPropertiesSet checking for a valid dictionary. If this call took place too early, then it would never allow the system to be in read-write mode unless rebooted. - Removed the dictionary check from SysAdminParamsImpl; it is now only responsible for the 'server.allowWrite' property - Call the TransactionServiceImpl's read-write veto code if the 'server.allowWrite' property changes - Better logging when vetoes are placed but also when vetoes are removed git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@110214 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,7 +26,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.repo.admin.SysAdminParams;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -57,9 +56,6 @@ public class TransactionServiceImpl implements TransactionService
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TransactionServiceImpl.class);
|
||||
|
||||
// SysAdmin cache - used to cluster certain configuration parameters
|
||||
private SysAdminParams sysAdminParams;
|
||||
|
||||
// Veto for allow write
|
||||
private Set<QName> writeVeto = new HashSet<QName>();
|
||||
private final QName generalVetoName = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "GeneralVeto");
|
||||
@@ -85,11 +81,6 @@ public class TransactionServiceImpl implements TransactionService
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
public void setSysAdminParams(SysAdminParams sysAdminParams)
|
||||
{
|
||||
this.sysAdminParams = sysAdminParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -99,7 +90,7 @@ public class TransactionServiceImpl implements TransactionService
|
||||
vetoReadLock.lock();
|
||||
try
|
||||
{
|
||||
return writeVeto.isEmpty() && this.sysAdminParams.getAllowWrite();
|
||||
return writeVeto.isEmpty();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -138,20 +129,25 @@ public class TransactionServiceImpl implements TransactionService
|
||||
*/
|
||||
public void setAllowWrite(boolean allowWrite, QName nameOfVeto)
|
||||
{
|
||||
if(logger.isDebugEnabled())
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("setAllowWrite:" + allowWrite + ", name of veto:" + nameOfVeto);
|
||||
logger.debug("setAllowWrite:" + allowWrite + ". Name of veto:" + nameOfVeto);
|
||||
}
|
||||
vetoWriteLock.lock();
|
||||
try
|
||||
{
|
||||
if(allowWrite)
|
||||
{
|
||||
writeVeto.remove(nameOfVeto);
|
||||
boolean removed = writeVeto.remove(nameOfVeto);
|
||||
if (removed)
|
||||
{
|
||||
logger.warn("setAllowWrite:" + allowWrite + ". Removing veto on write operations: " + nameOfVeto);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeVeto.add(nameOfVeto);
|
||||
logger.warn("setAllowWrite:" + allowWrite + ". Applying veto on write operations: " + nameOfVeto);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -178,7 +174,7 @@ public class TransactionServiceImpl implements TransactionService
|
||||
}
|
||||
else
|
||||
{
|
||||
return !writeVeto.isEmpty() || !this.sysAdminParams.getAllowWrite();
|
||||
return !writeVeto.isEmpty();
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
Reference in New Issue
Block a user