use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project eiger by wlloyd.
the class ThreadPoolProxyMBeanIterator method getCompactionThreshold.
/**
* Get the compaction threshold
*
* @param outs the stream to write to
*/
public void getCompactionThreshold(PrintStream outs, String ks, String cf) {
ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf);
outs.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold());
}
use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.
the class ColumnFamilyStoreMBeanIterator method getCFSMBeans.
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;
}
use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.
the class ColumnFamilyStoreMBeanIterator method getCfsProxy.
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;
}
use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.
the class ColumnFamilyStoreMBeanIterator method setCompactionThreshold.
/**
* Set the compaction threshold
*
* @param minimumCompactionThreshold minimum compaction threshold
* @param maximumCompactionThreshold maximum compaction threshold
*/
public void setCompactionThreshold(String ks, String cf, int minimumCompactionThreshold, int maximumCompactionThreshold) {
ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf);
cfsProxy.setCompactionThresholds(minimumCompactionThreshold, maximumCompactionThreshold);
}
use of org.apache.cassandra.db.ColumnFamilyStoreMBean in project cassandra by apache.
the class JMXAuthTest method executeMethod.
@Test
public void executeMethod() throws Throwable {
ColumnFamilyStoreMBean proxy = JMX.newMBeanProxy(connection, ObjectName.getInstance(tableMBean.getObjectName()), ColumnFamilyStoreMBean.class);
// grant EXECUTE on a single specific Table mbean
assertPermissionOnResource(Permission.EXECUTE, tableMBean, proxy::estimateKeys);
// grant EXECUTE on all Table mbeans in named keyspace
clearAllPermissions();
JMXResource allTablesInKeyspace = JMXResource.mbean(String.format("org.apache.cassandra.db:type=Tables,keyspace=%s,*", KEYSPACE));
assertPermissionOnResource(Permission.EXECUTE, allTablesInKeyspace, proxy::estimateKeys);
// grant EXECUTE on all Table mbeans
clearAllPermissions();
JMXResource allTables = JMXResource.mbean("org.apache.cassandra.db:type=Tables,*");
assertPermissionOnResource(Permission.EXECUTE, allTables, proxy::estimateKeys);
// grant EXECUTE ON ALL MBEANS
clearAllPermissions();
assertPermissionOnResource(Permission.EXECUTE, JMXResource.root(), proxy::estimateKeys);
}
Aggregations