当前位置: 首页>>代码示例>>Java>>正文


Java TabularData.keySet方法代码示例

本文整理汇总了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));
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:NodeTool.java

示例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;
}
 
开发者ID:advantageous,项目名称:boon,代码行数:20,代码来源:MBeans.java

示例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());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:JobSchedulerJmxManagementTests.java

示例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;
      }
   }));
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:JobSchedulerJmxManagementTests.java

示例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;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:29,代码来源:JMXUtils.java

示例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));
    }
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:24,代码来源:NodeTool.java

示例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"));
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:13,代码来源:FailureDetectorInfo.java

示例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));
	}
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:16,代码来源:EntityManagementBeanTest.java

示例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);
       }
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:30,代码来源:DocumentServiceProvider.java

示例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();
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:34,代码来源:LiveJvmServiceImpl.java

示例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());
    }
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:48,代码来源:SchemaCapacityPanel.java


注:本文中的javax.management.openmbean.TabularData.keySet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。