本文整理汇总了Java中org.apache.cassandra.db.ColumnFamilyStoreMBean类的典型用法代码示例。如果您正苦于以下问题:Java ColumnFamilyStoreMBean类的具体用法?Java ColumnFamilyStoreMBean怎么用?Java ColumnFamilyStoreMBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnFamilyStoreMBean类属于org.apache.cassandra.db包,在下文中一共展示了ColumnFamilyStoreMBean类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableNamesForKeyspace
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
@Override
public Set<String> getTableNamesForKeyspace(String keyspace) throws ReaperException {
Set<String> tableNames = new HashSet<>();
Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> proxies;
try {
proxies = ColumnFamilyStoreMBeanIterator.getColumnFamilyStoreMBeanProxies(mbeanServer);
} catch (IOException | MalformedObjectNameException e) {
throw new ReaperException("failed to get ColumnFamilyStoreMBean instances from JMX", e);
}
while (proxies.hasNext()) {
Map.Entry<String, ColumnFamilyStoreMBean> proxyEntry = proxies.next();
String keyspaceName = proxyEntry.getKey();
if (keyspace.equalsIgnoreCase(keyspaceName)) {
ColumnFamilyStoreMBean columnFamilyMBean = proxyEntry.getValue();
tableNames.add(columnFamilyMBean.getColumnFamilyName());
}
}
return tableNames;
}
示例2: getOffHeapMemoryUsed
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
/**
* Returns the total off heap memory used in MB.
* @return the total off heap memory used in MB.
*/
private static double getOffHeapMemoryUsed(NodeProbe probe)
{
long offHeapMemUsedInBytes = 0;
// get a list of column family stores
Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = probe.getColumnFamilyStoreMBeanProxies();
while (cfamilies.hasNext())
{
Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
String keyspaceName = entry.getKey();
String cfName = entry.getValue().getColumnFamilyName();
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "MemtableOffHeapSize");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "BloomFilterOffHeapMemoryUsed");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "IndexSummaryOffHeapMemoryUsed");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "CompressionMetadataOffHeapMemoryUsed");
}
return offHeapMemUsedInBytes / (1024d * 1024);
}
示例3: newColumnFamilyStore
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
private ColumnFamilyStoreMBean newColumnFamilyStore() {
return (ColumnFamilyStoreMBean) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{ColumnFamilyStoreMBean.class},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String name = method.getName();
switch (name) {
case "loadNewSSTables":
invocations.add("loadNewSSTables");
return null;
default:
throw new UnsupportedOperationException(name);
}
}
});
}
示例4: getCfsProxy
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf)
{
ColumnFamilyStoreMBean cfsProxy = null;
try
{
cfsProxy = JMX.newMBeanProxy(mbeanServerConn,
new ObjectName("org.apache.cassandra.db:type=ColumnFamilies,keyspace="+ks+",columnfamily="+cf),
ColumnFamilyStoreMBean.class);
}
catch (MalformedObjectNameException mone)
{
System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found.");
System.exit(1);
}
return cfsProxy;
}
示例5: next
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
@Override
public Map.Entry<String, ColumnFamilyStoreMBean> next() {
ObjectName objectName = resIter.next();
String keyspaceName = objectName.getKeyProperty("keyspace");
ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, objectName, ColumnFamilyStoreMBean.class);
return new AbstractMap.SimpleImmutableEntry<>(keyspaceName, cfsProxy);
}
示例6: getCfsProxy
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf)
{
ColumnFamilyStoreMBean cfsProxy = null;
try
{
String type = cf.contains(".") ? "IndexColumnFamilies" : "ColumnFamilies";
Set<ObjectName> beans = mbeanServerConn.queryNames(
new ObjectName("org.apache.cassandra.db:type=*" + type +",keyspace=" + ks + ",columnfamily=" + cf), null);
if (beans.isEmpty())
throw new MalformedObjectNameException("couldn't find that bean");
assert beans.size() == 1;
for (ObjectName bean : beans)
cfsProxy = JMX.newMBeanProxy(mbeanServerConn, bean, ColumnFamilyStoreMBean.class);
}
catch (MalformedObjectNameException mone)
{
System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found.");
System.exit(1);
}
catch (IOException e)
{
System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found: " + e);
System.exit(1);
}
return cfsProxy;
}
示例7: getCFSMBeans
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
private List<Entry<String, ColumnFamilyStoreMBean>> getCFSMBeans(MBeanServerConnection mbeanServerConn, String type)
throws MalformedObjectNameException, IOException
{
ObjectName query = new ObjectName("org.apache.cassandra.db:type=" + type +",*");
Set<ObjectName> cfObjects = mbeanServerConn.queryNames(query, null);
List<Entry<String, ColumnFamilyStoreMBean>> mbeans = new ArrayList<Entry<String, ColumnFamilyStoreMBean>>(cfObjects.size());
for(ObjectName n : cfObjects)
{
String keyspaceName = n.getKeyProperty("keyspace");
ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, n, ColumnFamilyStoreMBean.class);
mbeans.add(new AbstractMap.SimpleImmutableEntry<String, ColumnFamilyStoreMBean>(keyspaceName, cfsProxy));
}
return mbeans;
}
示例8: execute
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
checkArgument(args.size() == 2, "getcompactionthreshold requires ks and cf args");
String ks = args.get(0);
String cf = args.get(1);
ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf);
System.out.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" +
" min = " + cfsProxy.getMinimumCompactionThreshold() + ", " +
" max = " + cfsProxy.getMaximumCompactionThreshold());
}
示例9: printCompactionThreshold
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
/**
* Print the compaction threshold
*
* @param outs the stream to write to
*/
public void printCompactionThreshold(PrintStream outs, String ks, String cf)
{
ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf);
outs.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" +
" min = " + cfsProxy.getMinimumCompactionThreshold() + ", " +
" max = " + cfsProxy.getMaximumCompactionThreshold());
}
示例10: printCfHistograms
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
private void printCfHistograms(String keySpace, String columnFamily, PrintStream output)
{
ColumnFamilyStoreMBean store = this.probe.getCfsProxy(keySpace, columnFamily);
// default is 90 offsets
long[] offsets = new EstimatedHistogram().getBucketOffsets();
long[] rrlh = store.getRecentReadLatencyHistogramMicros();
long[] rwlh = store.getRecentWriteLatencyHistogramMicros();
long[] sprh = store.getRecentSSTablesPerReadHistogram();
long[] ersh = store.getEstimatedRowSizeHistogram();
long[] ecch = store.getEstimatedColumnCountHistogram();
output.println(String.format("%s/%s histograms", keySpace, columnFamily));
output.println(String.format("%-10s%10s%18s%18s%18s%18s",
"Offset", "SSTables", "Write Latency", "Read Latency", "Partition Size", "Cell Count"));
output.println(String.format("%-10s%10s%18s%18s%18s%18s",
"", "", "(micros)", "(micros)", "(bytes)", ""));
for (int i = 0; i < offsets.length; i++)
{
output.println(String.format("%-10d%10s%18s%18s%18s%18s",
offsets[i],
(i < sprh.length ? sprh[i] : "0"),
(i < rwlh.length ? rwlh[i] : "0"),
(i < rrlh.length ? rrlh[i] : "0"),
(i < ersh.length ? ersh[i] : "0"),
(i < ecch.length ? ecch[i] : "0")));
}
}
示例11: printCfHistograms
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
private void printCfHistograms(String keySpace, String columnFamily, PrintStream output)
{
ColumnFamilyStoreMBean store = this.probe.getCfsProxy(keySpace, columnFamily);
// default is 90 offsets
long[] offsets = new EstimatedHistogram().getBucketOffsets();
long[] rrlh = store.getRecentReadLatencyHistogramMicros();
long[] rwlh = store.getRecentWriteLatencyHistogramMicros();
long[] sprh = store.getRecentSSTablesPerReadHistogram();
long[] ersh = store.getEstimatedRowSizeHistogram();
long[] ecch = store.getEstimatedColumnCountHistogram();
output.println(String.format("%s/%s histograms", keySpace, columnFamily));
output.println(String.format("%-10s%10s%18s%18s%18s%18s",
"Offset", "SSTables", "Write Latency", "Read Latency", "Row Size", "Column Count"));
for (int i = 0; i < offsets.length; i++)
{
output.println(String.format("%-10d%10s%18s%18s%18s%18s",
offsets[i],
(i < sprh.length ? sprh[i] : "0"),
(i < rwlh.length ? rwlh[i] : "0"),
(i < rrlh.length ? rrlh[i] : "0"),
(i < ersh.length ? ersh[i] : "0"),
(i < ecch.length ? ecch[i] : "0")));
}
}
示例12: getCFSMBeans
import org.apache.cassandra.db.ColumnFamilyStoreMBean; //导入依赖的package包/类
private List<Entry<String, ColumnFamilyStoreMBean>> getCFSMBeans(MBeanServerConnection mbeanServerConn, String type)
throws MalformedObjectNameException, IOException
{
ObjectName query = new ObjectName("org.apache.cassandra.db:type=" + type +",*");
Set<ObjectName> cfObjects = mbeanServerConn.queryNames(query, null);
List<Entry<String, ColumnFamilyStoreMBean>> mbeans = new ArrayList<Entry<String, ColumnFamilyStoreMBean>>(cfObjects.size());
for(ObjectName n : cfObjects)
{
String tableName = n.getKeyProperty("keyspace");
ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, n, ColumnFamilyStoreMBean.class);
mbeans.add(new AbstractMap.SimpleImmutableEntry<String, ColumnFamilyStoreMBean>(tableName, cfsProxy));
}
return mbeans;
}