mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* 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.security.authentication.AuthenticationUtil;
|
||||
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.TenantUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
@@ -59,7 +58,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
|
||||
|
||||
// Dependencies
|
||||
private TransactionService transactionService;
|
||||
private TenantAdminService tenantAdminService;
|
||||
private ConfigDataCache configDataCache;
|
||||
|
||||
public void setTransactionService(TransactionService transactionService)
|
||||
@@ -67,11 +65,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
|
||||
this.transactionService = transactionService;
|
||||
}
|
||||
|
||||
public void setTenantAdminService(TenantAdminService tenantAdminService)
|
||||
{
|
||||
this.tenantAdminService = tenantAdminService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the asynchronously-controlled cache.
|
||||
*/
|
||||
@@ -192,12 +185,6 @@ public class RepoXMLConfigService extends XMLConfigService implements TenantDepl
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
if ((tenantAdminService != null) && (tenantAdminService.isEnabled()))
|
||||
{
|
||||
tenantAdminService.deployTenants(this, logger);
|
||||
tenantAdminService.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,12 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.repo.site;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
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.springframework.context.ApplicationEvent;
|
||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
@@ -36,23 +32,12 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
public class SiteServiceBootstrap extends AbstractLifecycleBean
|
||||
{
|
||||
private SiteService siteService;
|
||||
private TenantAdminService tenantAdminService;
|
||||
|
||||
public void setSiteService(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
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
@@ -64,29 +49,8 @@ public class SiteServiceBootstrap extends AbstractLifecycleBean
|
||||
return null;
|
||||
}
|
||||
}, 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
|
||||
protected void onShutdown(ApplicationEvent event)
|
||||
{
|
||||
|
Reference in New Issue
Block a user