本文整理汇总了Java中org.apache.cassandra.db.compaction.CompactionManagerMBean.getCompactions方法的典型用法代码示例。如果您正苦于以下问题:Java CompactionManagerMBean.getCompactions方法的具体用法?Java CompactionManagerMBean.getCompactions怎么用?Java CompactionManagerMBean.getCompactions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.compaction.CompactionManagerMBean
的用法示例。
在下文中一共展示了CompactionManagerMBean.getCompactions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printCompactionStats
import org.apache.cassandra.db.compaction.CompactionManagerMBean; //导入方法依赖的package包/类
public void printCompactionStats(PrintStream outs)
{
int compactionThroughput = probe.getCompactionThroughput();
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
outs.println("pending tasks: " + cm.getPendingTasks());
if (cm.getCompactions().size() > 0)
outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", "compaction type", "keyspace", "table", "completed", "total", "unit", "progress");
long remainingBytes = 0;
for (Map<String, String> c : cm.getCompactions())
{
String percentComplete = new Long(c.get("total")) == 0
? "n/a"
: new DecimalFormat("0.00").format((double) new Long(c.get("completed")) / new Long(c.get("total")) * 100) + "%";
outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("completed"), c.get("total"), c.get("unit"), percentComplete);
if (c.get("taskType").equals(OperationType.COMPACTION.toString()))
remainingBytes += (new Long(c.get("total")) - new Long(c.get("completed")));
}
long remainingTimeInSecs = compactionThroughput == 0 || remainingBytes == 0
? -1
: (remainingBytes) / (long) (1024L * 1024L * compactionThroughput);
String remainingTime = remainingTimeInSecs < 0
? "n/a"
: String.format("%dh%02dm%02ds", remainingTimeInSecs / 3600, (remainingTimeInSecs % 3600) / 60, (remainingTimeInSecs % 60));
outs.printf("%25s%10s%n", "Active compaction remaining time : ", remainingTime);
}
示例2: printCompactionStats
import org.apache.cassandra.db.compaction.CompactionManagerMBean; //导入方法依赖的package包/类
public void printCompactionStats(PrintStream outs)
{
int compactionThroughput = probe.getCompactionThroughput();
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
outs.println("pending tasks: " + cm.getPendingTasks());
if (cm.getCompactions().size() > 0)
outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", "compaction type", "keyspace", "column family", "completed", "total", "unit", "progress");
long remainingBytes = 0;
for (Map<String, String> c : cm.getCompactions())
{
String percentComplete = new Long(c.get("total")) == 0
? "n/a"
: new DecimalFormat("0.00").format((double) new Long(c.get("completed")) / new Long(c.get("total")) * 100) + "%";
outs.printf("%25s%16s%16s%16s%16s%10s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("completed"), c.get("total"), c.get("unit"), percentComplete);
if (c.get("taskType").equals(OperationType.COMPACTION.toString()))
remainingBytes += (new Long(c.get("total")) - new Long(c.get("completed")));
}
long remainingTimeInSecs = compactionThroughput == 0 || remainingBytes == 0
? -1
: (remainingBytes) / (long) (1024L * 1024L * compactionThroughput);
String remainingTime = remainingTimeInSecs < 0
? "n/a"
: String.format("%dh%02dm%02ds", remainingTimeInSecs / 3600, (remainingTimeInSecs % 3600) / 60, (remainingTimeInSecs % 60));
outs.printf("%25s%10s%n", "Active compaction remaining time : ", remainingTime);
}
示例3: execute
import org.apache.cassandra.db.compaction.CompactionManagerMBean; //导入方法依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
int compactionThroughput = probe.getCompactionThroughput();
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
System.out.println("pending tasks: " + probe.getCompactionMetric("PendingTasks"));
if (cm.getCompactions().size() > 0)
System.out.printf("%25s%16s%16s%16s%16s%10s%10s%n", "compaction type", "keyspace", "table", "completed", "total", "unit", "progress");
long remainingBytes = 0;
for (Map<String, String> c : cm.getCompactions())
{
String percentComplete = new Long(c.get("total")) == 0
? "n/a"
: new DecimalFormat("0.00").format((double) new Long(c.get("completed")) / new Long(c.get("total")) * 100) + "%";
System.out.printf("%25s%16s%16s%16s%16s%10s%10s%n", c.get("taskType"), c.get("keyspace"), c.get("columnfamily"), c.get("completed"), c.get("total"), c.get("unit"), percentComplete);
if (c.get("taskType").equals(OperationType.COMPACTION.toString()))
remainingBytes += (new Long(c.get("total")) - new Long(c.get("completed")));
}
long remainingTimeInSecs = compactionThroughput == 0 || remainingBytes == 0
? -1
: (remainingBytes) / (1024L * 1024L * compactionThroughput);
String remainingTime = remainingTimeInSecs < 0
? "n/a"
: format("%dh%02dm%02ds", remainingTimeInSecs / 3600, (remainingTimeInSecs % 3600) / 60, (remainingTimeInSecs % 60));
System.out.printf("%25s%10s%n", "Active compaction remaining time : ", remainingTime);
}
示例4: printCompactionStats
import org.apache.cassandra.db.compaction.CompactionManagerMBean; //导入方法依赖的package包/类
public void printCompactionStats(PrintStream outs)
{
CompactionManagerMBean cm = probe.getCompactionManagerProxy();
outs.println("pending tasks: " + cm.getPendingTasks());
if (cm.getCompactions().size() > 0)
outs.printf("%25s%16s%16s%16s%16s%10s%n", "compaction type", "keyspace", "column family", "bytes compacted", "bytes total", "progress");
for (CompactionInfo c : cm.getCompactions())
{
String percentComplete = c.getTotalBytes() == 0
? "n/a"
: new DecimalFormat("0.00").format((double) c.getBytesComplete() / c.getTotalBytes() * 100) + "%";
outs.printf("%25s%16s%16s%16s%16s%10s%n", c.getTaskType(), c.getKeyspace(), c.getColumnFamily(), c.getBytesComplete(), c.getTotalBytes(), percentComplete);
}
}