You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bd...@apache.org on 2017/04/14 16:05:05 UTC
cassandra git commit: Fixing failing test and a few style problems
introduced in 12661
Repository: cassandra
Updated Branches:
refs/heads/trunk 02ded0194 -> 8a6fc4e2a
Fixing failing test and a few style problems introduced in 12661
Patch by Ed Capriolo; Reviewed by Blake Eggleston for CASSANDRA-12661
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8a6fc4e2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8a6fc4e2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8a6fc4e2
Branch: refs/heads/trunk
Commit: 8a6fc4e2ac8012ae2d3e4abf6c6502cbeda5159c
Parents: 02ded01
Author: Edward <ed...@gmail.com>
Authored: Wed Apr 12 12:11:00 2017 -0400
Committer: Blake Eggleston <bd...@gmail.com>
Committed: Fri Apr 14 09:00:08 2017 -0700
----------------------------------------------------------------------
.../apache/cassandra/service/GCInspector.java | 13 +++-------
.../cassandra/service/GCInspectorTest.java | 27 +++++++++++++++++++-
2 files changed, 30 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a6fc4e2/src/java/org/apache/cassandra/service/GCInspector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java
index b016249..657d3ad 100644
--- a/src/java/org/apache/cassandra/service/GCInspector.java
+++ b/src/java/org/apache/cassandra/service/GCInspector.java
@@ -53,8 +53,8 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
{
public static final String MBEAN_NAME = "org.apache.cassandra.service:type=GCInspector";
private static final Logger logger = LoggerFactory.getLogger(GCInspector.class);
- private volatile static long gcLogThreshholdInMs = DatabaseDescriptor.getGCLogThreshold();
- private volatile static long gcWarnThreasholdInMs = DatabaseDescriptor.getGCWarnThreshold();
+ private volatile long gcLogThreshholdInMs = DatabaseDescriptor.getGCLogThreshold();
+ private volatile long gcWarnThreasholdInMs = DatabaseDescriptor.getGCWarnThreshold();
/*
* The field from java.nio.Bits that tracks the total number of allocated
@@ -335,24 +335,21 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
}
}
- @Override
public void setGcWarnThresholdInMs(long threshold)
{
if (threshold < 0)
- throw new IllegalArgumentException("Threashold must be greater than 0");
+ throw new IllegalArgumentException("Threshold must be greater than or equal to 0");
if (threshold != 0 && threshold <= gcLogThreshholdInMs)
- throw new IllegalArgumentException("Threashold must be greater than gcLogTreasholdInMs which is currently "
+ throw new IllegalArgumentException("Threshold must be greater than gcLogTreasholdInMs which is currently "
+ gcLogThreshholdInMs);
gcWarnThreasholdInMs = threshold;
}
- @Override
public long getGcWarnThresholdInMs()
{
return gcWarnThreasholdInMs;
}
- @Override
public void setGcLogThresholdInMs(long threshold)
{
if (threshold <= 0)
@@ -363,13 +360,11 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
gcLogThreshholdInMs = threshold;
}
- @Override
public long getGcLogThresholdInMs()
{
return gcLogThreshholdInMs;
}
- @Override
public long getStatusThresholdInMs()
{
return gcWarnThreasholdInMs != 0 ? gcWarnThreasholdInMs : gcLogThreshholdInMs;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a6fc4e2/test/unit/org/apache/cassandra/service/GCInspectorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/GCInspectorTest.java b/test/unit/org/apache/cassandra/service/GCInspectorTest.java
index 872c736..0c5ddef 100644
--- a/test/unit/org/apache/cassandra/service/GCInspectorTest.java
+++ b/test/unit/org/apache/cassandra/service/GCInspectorTest.java
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.cassandra.service;
import org.apache.cassandra.OrderedJUnit4ClassRunner;
@@ -21,7 +38,8 @@ public class GCInspectorTest
}
@Before
- public void before(){
+ public void before()
+ {
gcInspector = new GCInspector();
}
@@ -57,4 +75,11 @@ public class GCInspectorTest
gcInspector.setGcLogThresholdInMs(gcInspector.getGcWarnThresholdInMs() + 1);
}
+ @Test
+ public void testDefaults()
+ {
+ gcInspector.setGcLogThresholdInMs(200);
+ gcInspector.setGcWarnThresholdInMs(1000);
+ }
+
}