本文整理汇总了Java中javax.management.openmbean.TabularData.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java TabularData.keySet方法的具体用法?Java TabularData.keySet怎么用?Java TabularData.keySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.openmbean.TabularData
的用法示例。
在下文中一共展示了TabularData.keySet方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
System.out.println("Compaction History: ");
TabularData tabularData = probe.getCompactionHistory();
if (tabularData.isEmpty())
{
System.out.printf("There is no compaction history");
return;
}
String format = "%-41s%-19s%-29s%-26s%-15s%-15s%s%n";
List<String> indexNames = tabularData.getTabularType().getIndexNames();
System.out.printf(format, toArray(indexNames, Object.class));
Set<?> values = tabularData.keySet();
for (Object eachValue : values)
{
List<?> value = (List<?>) eachValue;
System.out.printf(format, toArray(value, Object.class));
}
}
示例2: convertFromTabularDataToMap
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private static Object convertFromTabularDataToMap( Object value ) {
final TabularData data = ( TabularData ) value;
final Set<List<?>> keys = ( Set<List<?>> ) data.keySet();
final Map<String, Object> map = new HashMap<>();
for ( final List<?> key : keys ) {
final Object subValue = convertValue( data.get( key.toArray() ) );
if ( key.size() == 1 ) {
map.put( convertValue( key.get( 0 ) ).toString(), subValue );
} else {
map.put( convertValue( key ).toString(), subValue );
}
}
value = map;
return value;
}
示例3: testRemvoeJob
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Test
public void testRemvoeJob() throws Exception {
JobSchedulerViewMBean view = getJobSchedulerMBean();
assertNotNull(view);
assertTrue(view.getAllJobs().isEmpty());
scheduleMessage(60000, -1, -1);
assertFalse(view.getAllJobs().isEmpty());
TabularData jobs = view.getAllJobs();
assertEquals(1, jobs.size());
for (Object key : jobs.keySet()) {
String jobId = ((List<?>) key).get(0).toString();
LOG.info("Attempting to remove Job: {}", jobId);
view.removeJob(jobId);
}
assertTrue(view.getAllJobs().isEmpty());
}
示例4: testGetExecutionCount
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Test
public void testGetExecutionCount() throws Exception {
final JobSchedulerViewMBean view = getJobSchedulerMBean();
assertNotNull(view);
assertTrue(view.getAllJobs().isEmpty());
scheduleMessage(10000, 1000, 10);
assertFalse(view.getAllJobs().isEmpty());
TabularData jobs = view.getAllJobs();
assertEquals(1, jobs.size());
String jobId = null;
for (Object key : jobs.keySet()) {
jobId = ((List<?>) key).get(0).toString();
}
final String fixedJobId = jobId;
LOG.info("Attempting to get execution count for Job: {}", jobId);
assertEquals(0, view.getExecutionCount(jobId));
assertTrue("Should execute again", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return view.getExecutionCount(fixedJobId) > 0;
}
}));
}
示例5: aggregateStats
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
/**
* Aggregates two tabular structures into one.
*
* @param source the source tabular
* @param target the target tabular
* @param aggregator the aggregator which will perform data aggregation
* @return the aggregated tabular structure
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static TabularData aggregateStats(TabularData source, TabularData target, StatsAggregator aggregator) {
logger.debug("aggregateStats.enter; got source: {}", source);
if (source == null) {
return target;
}
TabularData result = new TabularDataSupport(source.getTabularType());
Set<List> keys = (Set<List>) source.keySet();
if (target == null) {
return source;
} else {
for (List key: keys) {
Object[] index = key.toArray();
CompositeData aggr = aggregateStats(source.get(index), target.get(index), aggregator);
result.put(aggr);
}
}
logger.debug("aggregateStats.exit; returning: {}", result);
return result;
}
示例6: execute
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
System.out.println("Compaction History: ");
TabularData tabularData = probe.getCompactionHistory();
if (tabularData.isEmpty())
{
System.out.printf("There is no compaction history");
return;
}
String format = "%-41s%-19s%-29s%-26s%-15s%-15s%s%n";
List<String> indexNames = tabularData.getTabularType().getIndexNames();
System.out.printf(format, toArray(indexNames, String.class));
Set<?> values = tabularData.keySet();
for (Object eachValue : values)
{
List<?> value = (List<?>) eachValue;
System.out.printf(format, toArray(value, Object.class));
}
}
示例7: execute
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
TabularData data = probe.getFailureDetectorPhilValues();
System.out.printf("%10s,%16s%n", "Endpoint", "Phi");
for (Object o : data.keySet())
{
@SuppressWarnings({ "rawtypes", "unchecked" })
CompositeData datum = data.get(((List) o).toArray(new Object[((List) o).size()]));
System.out.printf("%10s,%16.8f%n",datum.get("Endpoint"), datum.get("PHI"));
}
}
示例8: testGetEntities
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Test
public void testGetEntities() throws Exception {
ObjectName name = getObjectName();
TabularData entities = (TabularData) mbsc.getAttribute(name, getEntityName());
assertNotNull(entities);
List<String> expected = Arrays.asList(getExpectedEntities());
assertEquals(expected.size(), entities.size());
Set<List> keys = (Set<List>) entities.keySet();
for (List key: keys) {
Object[] index = key.toArray();
CompositeData schema = entities.get(index);
String sn = (String) schema.get("name");
assertTrue(expected.contains(sn));
}
}
示例9: getCollections
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
@Override
public List<Collection> getCollections() throws ServiceException {
List<Collection> result = new ArrayList<>();
try {
ObjectName on = getDocMgrObjectName();
Object res = connection.getAttribute(on, "Collections");
if (res == null) {
return result;
}
TabularData clns = (TabularData) res;
Set<List> keys = (Set<List>) clns.keySet();
res = connection.getAttribute(on, "CollectionStatistics");
TabularData stats = (TabularData) res;
for (List key: keys) {
Object[] index = key.toArray();
CompositeData clnData = clns.get(index);
CompositeData stsData = null;
if (stats != null) {
stsData = stats.get(index);
}
Collection cln = readCollection(clnData, stsData);
result.add(cln);
}
return result;
} catch (Exception ex) {
LOGGER.throwing(this.getClass().getName(), "getCollections", ex);
throw new ServiceException(ex);
}
}
示例10: getTabularDataValue
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
private static MBeanDump.MBeanValue getTabularDataValue(TabularData tabularData) {
// linked hash map used to preserve row ordering
List<MBeanDump.MBeanValueMapEntry> outerEntries = Lists.newArrayList();
Set<String> attributeNames = tabularData.getTabularType().getRowType().keySet();
for (Object key : tabularData.keySet()) {
// TabularData.keySet() returns "Set<List<?>> but is declared Set<?> for
// compatibility reasons" (see javadocs) so safe to cast to List<?>
List<?> keyList = (List<?>) key;
@SuppressWarnings("argument.type.incompatible")
String keyString = Joiner.on(", ").join(keyList);
@SuppressWarnings("argument.type.incompatible")
CompositeData compositeData = tabularData.get(keyList.toArray());
// linked hash map used to preserve attribute ordering
List<MBeanDump.MBeanValueMapEntry> innerEntries = Lists.newArrayList();
for (String attributeName : attributeNames) {
innerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
.setKey(attributeName)
.setValue(getMBeanAttributeValue(compositeData.get(attributeName)))
.build());
}
outerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
.setKey(keyString)
.setValue(MBeanDump.MBeanValue.newBuilder()
.setMap(MBeanDump.MBeanValueMap.newBuilder()
.addAllEntry(innerEntries))
.build())
.build());
}
return MBeanDump.MBeanValue.newBuilder()
.setMap(MBeanDump.MBeanValueMap.newBuilder()
.addAllEntry(outerEntries))
.build();
}
示例11: run
import javax.management.openmbean.TabularData; //导入方法依赖的package包/类
public void run() {
try {
Schema s = service.getSchema(schema);
if (s != null && s.isActive()) {
long totalECost = 0;
long totalCCost = 0;
long totalRCost = 0;
long totalICost = 0;
long totalDCost = 0;
TabularData data = service.getSchemaPartitionStatistics(schema);
Set<List<Integer>> keys = (Set<List<Integer>>) data.keySet();
Set<List<Integer>> sorted = new TreeSet<List<Integer>>(this);
sorted.addAll(keys);
for (List key: sorted) {
Object[] index = key.toArray();
CompositeData cd = data.get(index);
int partition = (Integer) cd.get("partition");
long eCost = (Long) cd.get("element cost");
eCost = new java.math.BigDecimal(eCost).movePointLeft(3).longValue();
totalECost += eCost;
long cCost = (Long) cd.get("content cost");
cCost = new java.math.BigDecimal(cCost).movePointLeft(3).longValue();
totalCCost += cCost;
long rCost = (Long) cd.get("result cost");
rCost = new java.math.BigDecimal(rCost).movePointLeft(3).longValue();
totalRCost += rCost;
long iCost = (Long) cd.get("index cost");
iCost = new java.math.BigDecimal(iCost).movePointLeft(3).longValue();
totalICost += iCost;
long dCost = (Long) cd.get("document cost");
dCost = new java.math.BigDecimal(dCost).movePointLeft(3).longValue();
totalDCost += dCost;
chart.addValues(partition, new long[] {eCost, cCost, rCost, iCost, dCost});
}
long overallCost = totalECost + totalCCost + totalRCost + totalICost + totalDCost;
Component[] labels = header.getComponents();
((JLabel) labels[0]).setText("Total elements cost: " + chart.formatDecimal(totalECost));
((JLabel) labels[1]).setText("Total content cost: " + chart.formatDecimal(totalCCost));
((JLabel) labels[2]).setText("Total results cost: " + chart.formatDecimal(totalRCost));
((JLabel) labels[4]).setText("Total indices cost: " + chart.formatDecimal(totalICost));
((JLabel) labels[5]).setText("Total documents cost: " + chart.formatDecimal(totalDCost));
((JLabel) labels[6]).setText("Overall cost: " + chart.formatDecimal(overallCost));
}
} catch (Exception ex) {
LOGGER.severe(ex.getMessage());
}
}