ACE-415: MT: Server bootstraps all tenants on startup - linear scaling

- Ripped out bootstrap calls to warm all tenants (uses of TenantService.getAllTenants)
 - This brings Enterprise in line with was used to be plugged into Cloud as an override


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@60265 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2014-01-21 17:32:40 +00:00
parent 5d830f1a9f
commit 29e72b1dad
3 changed files with 1 additions and 51 deletions

View File

@@ -722,7 +722,6 @@
<!-- Site service cache warmer --> <!-- Site service cache warmer -->
<bean id="siteServiceBootstrap" class="org.alfresco.repo.site.SiteServiceBootstrap"> <bean id="siteServiceBootstrap" class="org.alfresco.repo.site.SiteServiceBootstrap">
<property name="siteService" ref="SiteService" /> <property name="siteService" ref="SiteService" />
<property name="tenantAdminService" ref="tenantAdminService" />
</bean> </bean>
<!-- Scheduled persisted actions - load into quartz --> <!-- Scheduled persisted actions - load into quartz -->

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2013 Alfresco Software Limited. * Copyright (C) 2005-2014 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -27,7 +27,6 @@ import org.alfresco.repo.config.ConfigDataCache.ConfigData;
import org.alfresco.repo.config.ConfigDataCache.ImmutableConfigData; import org.alfresco.repo.config.ConfigDataCache.ImmutableConfigData;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.repo.tenant.TenantDeployer; import org.alfresco.repo.tenant.TenantDeployer;
import org.alfresco.repo.tenant.TenantUtil; import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -59,7 +58,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
// Dependencies // Dependencies
private TransactionService transactionService; private TransactionService transactionService;
private TenantAdminService tenantAdminService;
private ConfigDataCache configDataCache; private ConfigDataCache configDataCache;
public void setTransactionService(TransactionService transactionService) public void setTransactionService(TransactionService transactionService)
@@ -67,11 +65,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
this.transactionService = transactionService; this.transactionService = transactionService;
} }
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.tenantAdminService = tenantAdminService;
}
/** /**
* Set the asynchronously-controlled cache. * Set the asynchronously-controlled cache.
*/ */
@@ -192,12 +185,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
return null; return null;
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
if ((tenantAdminService != null) && (tenantAdminService.isEnabled()))
{
tenantAdminService.deployTenants(this, logger);
tenantAdminService.register(this);
}
} }
@Override @Override

View File

@@ -18,12 +18,8 @@
*/ */
package org.alfresco.repo.site; package org.alfresco.repo.site;
import java.util.List;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.Tenant;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.cmr.site.SiteService;
import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEvent;
import org.springframework.extensions.surf.util.AbstractLifecycleBean; import org.springframework.extensions.surf.util.AbstractLifecycleBean;
@@ -36,23 +32,12 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
public class SiteServiceBootstrap extends AbstractLifecycleBean public class SiteServiceBootstrap extends AbstractLifecycleBean
{ {
private SiteService siteService; private SiteService siteService;
private TenantAdminService tenantAdminService;
public void setSiteService(SiteService siteService) public void setSiteService(SiteService siteService)
{ {
this.siteService = siteService; this.siteService = siteService;
} }
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.tenantAdminService = tenantAdminService;
}
/*
* (non-Javadoc)
* @seeorg.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.
* ApplicationEvent)
*/
@Override @Override
protected void onBootstrap(ApplicationEvent event) protected void onBootstrap(ApplicationEvent event)
{ {
@@ -64,29 +49,8 @@ public class SiteServiceBootstrap extends AbstractLifecycleBean
return null; return null;
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
if (tenantAdminService.isEnabled())
{
List<Tenant> tenants = tenantAdminService.getAllTenants();
for (Tenant tenant : tenants)
{
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
siteService.listSites("a");
return null;
}
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenant.getTenantDomain()));
}
}
} }
/*
* (non-Javadoc)
* @seeorg.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.
* ApplicationEvent)
*/
@Override @Override
protected void onShutdown(ApplicationEvent event) protected void onShutdown(ApplicationEvent event)
{ {