ApiServer: Get rid of finding system account and user at init() time Signed-off-by: Rohit Yadav <[email protected]> (cherry picked from commit 8094e933b08d830822dbdc711e5caad3c067b5d7)
Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/cb83c234 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/cb83c234 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/cb83c234 Branch: refs/heads/4.1 Commit: cb83c23484c0fb9b276a1aed9087436b394a6f89 Parents: 65d1a4b Author: Rohit Yadav <[email protected]> Authored: Sat Feb 16 17:09:37 2013 +0530 Committer: Rohit Yadav <[email protected]> Committed: Sun Feb 17 00:24:58 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/api/ApiServer.java | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cb83c234/server/src/com/cloud/api/ApiServer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index 6f4c932..c9d3abc 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -157,8 +157,6 @@ public class ApiServer implements HttpRequestHandler { @Inject List<PluggableService> _pluggableServices; @Inject List<APIChecker> _apiAccessCheckers; - private Account _systemAccount = null; - private User _systemUser = null; @Inject private RegionManager _regionMgr = null; private static int _workerCount = 0; @@ -182,9 +180,6 @@ public class ApiServer implements HttpRequestHandler { } public void init() { - _systemAccount = _accountMgr.getSystemAccount(); - _systemUser = _accountMgr.getSystemUser(); - Integer apiPort = null; // api port, null by default SearchCriteria<ConfigurationVO> sc = _configDao.createSearchCriteria(); sc.addAnd("name", SearchCriteria.Op.EQ, "integration.api.port"); @@ -278,7 +273,7 @@ public class ApiServer implements HttpRequestHandler { try { // always trust commands from API port, user context will always be UID_SYSTEM/ACCOUNT_ID_SYSTEM - UserContext.registerContext(_systemUser.getId(), _systemAccount, null, true); + UserContext.registerContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, true); sb.insert(0, "(userId=" + User.UID_SYSTEM + " accountId=" + Account.ACCOUNT_ID_SYSTEM + " sessionId=" + null + ") "); String responseText = handleRequest(parameterMap, responseType, sb); sb.append(" 200 " + ((responseText == null) ? 0 : responseText.length()));
