Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8237210A80 for ; Thu, 3 Oct 2013 19:48:06 +0000 (UTC) Received: (qmail 13688 invoked by uid 500); 3 Oct 2013 19:48:03 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 13499 invoked by uid 500); 3 Oct 2013 19:48:00 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 12938 invoked by uid 99); 3 Oct 2013 19:47:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Oct 2013 19:47:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C36E790EE27; Thu, 3 Oct 2013 19:47:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Thu, 03 Oct 2013 19:48:01 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [08/10] git commit: updated refs/heads/ui-restyle to fbb0499 Temporary fix for the chicken and egg problem when making changes to the configuration database. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3f583684 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3f583684 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3f583684 Branch: refs/heads/ui-restyle Commit: 3f583684c6ddcf7efb66adada63957f8ca06cfdc Parents: a3babdd Author: Hugo Trippaers Authored: Thu Oct 3 12:33:10 2013 +0200 Committer: Hugo Trippaers Committed: Thu Oct 3 12:36:34 2013 +0200 ---------------------------------------------------------------------- .../cache/manager/StorageCacheReplacementAlgorithmLRU.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f583684/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java ---------------------------------------------------------------------- diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java index fc96a0d..ed1fc1a 100644 --- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java +++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheReplacementAlgorithmLRU.java @@ -60,7 +60,10 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem @PostConstruct public void initialize() { - unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()), 30); + /* Avoid using configDao at this time, we can't be sure that the database is already upgraded + * and there might be fatal errors when using a dao. + */ + //unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()), 30); } public void setUnusedTimeInterval(Integer interval) { @@ -69,6 +72,9 @@ public class StorageCacheReplacementAlgorithmLRU implements StorageCacheReplacem @Override public DataObject chooseOneToBeReplaced(DataStore store) { + if (unusedTimeInterval == null) { + unusedTimeInterval = NumbersUtil.parseInt(configDao.getValue(Config.StorageCacheReplacementLRUTimeInterval.key()), 30); + } Calendar cal = Calendar.getInstance(); cal.setTime(DateUtil.now()); cal.add(Calendar.DAY_OF_MONTH, -unusedTimeInterval.intValue());