本文整理匯總了Java中javax.management.openmbean.TabularDataSupport類的典型用法代碼示例。如果您正苦於以下問題:Java TabularDataSupport類的具體用法?Java TabularDataSupport怎麽用?Java TabularDataSupport使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TabularDataSupport類屬於javax.management.openmbean包,在下文中一共展示了TabularDataSupport類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCacheContents
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public final TabularData getCacheContents() throws OpenDataException {
final CompositeType cacheEntryType = getCacheEntryType();
final TabularDataSupport tabularData = new TabularDataSupport(
new TabularType("Cache Entries", "Cache Entries", cacheEntryType, new String[] { "Cache Key" }));
ConcurrentMap<K, V> cacheAsMap = getCache().asMap();
for (final Map.Entry<K, V> entry : cacheAsMap.entrySet()) {
final Map<String, Object> data = new HashMap<String, Object>();
data.put("Cache Key", entry.getKey().toString());
V cacheObj = entry.getValue();
if (cacheObj != null) {
addCacheData(data, cacheObj);
}
tabularData.put(new CompositeDataSupport(cacheEntryType, data));
}
return tabularData;
}
示例2: getStatistics
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
public synchronized TabularDataSupport getStatistics() {
TabularDataSupport apiStatisticsTable = new TabularDataSupport(API_STATISTICS_TYPE);
for (InvocationStatistics methodStats : API_STATISTICS.getInvocationStatistics()) {
Object[] itemValues = {methodStats.getName(),
methodStats.getCallCount(),
methodStats.getErrorCount(),
methodStats.getTotalTime(),
methodStats.getAverageTime()};
try {
CompositeData result = new CompositeDataSupport(METHOD_STATS_TYPE,
ITEM_NAMES,
itemValues);
apiStatisticsTable.put(result);
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
return apiStatisticsTable;
}
示例3: browse
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public TabularData browse(String routeId, int limit, boolean sortByLongestDuration) {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listInflightExchangesTabularType());
Collection<InflightRepository.InflightExchange> exchanges = inflightRepository.browse(routeId, limit, sortByLongestDuration);
for (InflightRepository.InflightExchange entry : exchanges) {
CompositeType ct = CamelOpenMBeanTypes.listInflightExchangesCompositeType();
String exchangeId = entry.getExchange().getExchangeId();
String fromRouteId = entry.getFromRouteId();
String atRouteId = entry.getAtRouteId();
String nodeId = entry.getNodeId();
String elapsed = "" + entry.getElapsed();
String duration = "" + entry.getDuration();
CompositeData data = new CompositeDataSupport(ct,
new String[]{"exchangeId", "fromRouteId", "routeId", "nodeId", "elapsed", "duration"},
new Object[]{exchangeId, fromRouteId, atRouteId, nodeId, elapsed, duration});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例4: extendedInformation
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public TabularData extendedInformation() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());
// we only have 1 endpoint
CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
String url = getDestination();
Long hits = processor.getCounter();
CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "hits"}, new Object[]{url, hits});
answer.put(data);
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例5: listEndpoints
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public TabularData listEndpoints() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEndpointsTabularType());
Collection<Endpoint> endpoints = endpointRegistry.values();
for (Endpoint endpoint : endpoints) {
CompositeType ct = CamelOpenMBeanTypes.listEndpointsCompositeType();
String url = endpoint.getEndpointUri();
if (sanitize) {
url = URISupport.sanitizeUri(url);
}
boolean fromStatic = endpointRegistry.isStatic(url);
boolean fromDynamic = endpointRegistry.isDynamic(url);
CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "static", "dynamic"}, new Object[]{url, fromStatic, fromDynamic});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例6: browse
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public TabularData browse() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listAwaitThreadsTabularType());
Collection<AsyncProcessorAwaitManager.AwaitThread> threads = manager.browse();
for (AsyncProcessorAwaitManager.AwaitThread entry : threads) {
CompositeType ct = CamelOpenMBeanTypes.listAwaitThreadsCompositeType();
String id = "" + entry.getBlockedThread().getId();
String name = entry.getBlockedThread().getName();
String exchangeId = entry.getExchange().getExchangeId();
String routeId = entry.getRouteId();
String nodeId = entry.getNodeId();
String duration = "" + entry.getWaitDuration();
CompositeData data = new CompositeDataSupport(ct,
new String[]{"id", "name", "exchangeId", "routeId", "nodeId", "duration"},
new Object[]{id, name, exchangeId, routeId, nodeId, duration});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例7: listTypeConverters
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
public TabularData listTypeConverters() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTypeConvertersTabularType());
List<Class<?>[]> converters = registry.listAllTypeConvertersFromTo();
for (Class<?>[] entry : converters) {
CompositeType ct = CamelOpenMBeanTypes.listTypeConvertersCompositeType();
String from = entry[0].getCanonicalName();
String to = entry[1].getCanonicalName();
CompositeData data = new CompositeDataSupport(ct, new String[]{"from", "to"}, new Object[]{from, to});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例8: listEips
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
public TabularData listEips() throws Exception {
try {
// find all EIPs
Map<String, Properties> eips = context.findEips();
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEipsTabularType());
// gather EIP detail for each eip
for (Map.Entry<String, Properties> entry : eips.entrySet()) {
String name = entry.getKey();
String title = (String) entry.getValue().get("title");
String description = (String) entry.getValue().get("description");
String label = (String) entry.getValue().get("label");
String type = (String) entry.getValue().get("class");
String status = CamelContextHelper.isEipInUse(context, name) ? "in use" : "on classpath";
CompositeType ct = CamelOpenMBeanTypes.listEipsCompositeType();
CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "title", "description", "label", "status", "type"},
new Object[]{name, title, description, label, status, type});
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
示例9: getPhiValues
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public TabularData getPhiValues() throws OpenDataException {
final CompositeType ct = new CompositeType("Node", "Node", new String[] { "Endpoint", "PHI" },
new String[] { "IP of the endpoint", "PHI value" },
new OpenType[] { SimpleType.STRING, SimpleType.DOUBLE });
final TabularDataSupport results = new TabularDataSupport(
new TabularType("PhiList", "PhiList", ct, new String[] { "Endpoint" }));
final JsonArray arr = client.getJsonArray("/failure_detector/endpoint_phi_values");
for (JsonValue v : arr) {
JsonObject o = (JsonObject) v;
String endpoint = o.getString("endpoint");
double phi = Double.parseDouble(o.getString("phi"));
if (phi != Double.MIN_VALUE) {
// returned values are scaled by PHI_FACTOR so that the are on
// the same scale as PhiConvictThreshold
final CompositeData data = new CompositeDataSupport(ct, new String[] { "Endpoint", "PHI" },
new Object[] { endpoint, phi * PHI_FACTOR });
results.put(data);
}
}
return results;
}
示例10: getResult
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
/**
* Populates the Result objects. This is a recursive function. Query
* contains the keys that we want to get the values of.
*/
private void getResult(Builder<Result> accumulator, String attributeName, CompositeData cds) {
CompositeType t = cds.getCompositeType();
Map<String, Object> values = newHashMap();
Set<String> keys = t.keySet();
for (String key : keys) {
Object value = cds.get(key);
if (value instanceof TabularDataSupport) {
TabularDataSupport tds = (TabularDataSupport) value;
processTabularDataSupport(accumulator, attributeName + SEPERATOR + key, tds);
values.put(key, value);
} else if (value instanceof CompositeDataSupport) {
// now recursively go through everything.
CompositeDataSupport cds2 = (CompositeDataSupport) value;
getResult(accumulator, attributeName, cds2);
return; // because we don't want to add to the list yet.
} else {
values.put(key, value);
}
}
Result r = getNewResultObject(attributeName, values);
accumulator.add(r);
}
示例11: apply
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
@Override
public TabularData apply(InProgressSnapshot from) {
List<OpenType<?>> types = Lists.transform(from.getColumnClasses(), CLASS_TO_OPENTYPE);
CompositeType rowType;
try {
int columnCount = from.getColumnCount();
rowType = new CompositeType("Snapshot row", "Snapshot row", from.getColumnNames()
.toArray(new String[columnCount]), from.getColumnDescriptions().toArray(
new String[columnCount]), types.toArray(new OpenType<?>[columnCount]));
TabularType type = new TabularType("Snapshot", "Snapshot", rowType,
new String[] { "Thread name" });
TabularData data = new TabularDataSupport(type);
for (Map<String, Object> dataRow : from.getValues()) {
CompositeData row = new CompositeDataSupport(rowType, dataRow);
data.put(row);
}
return data;
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
示例12: aggregateStats
import javax.management.openmbean.TabularDataSupport; //導入依賴的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;
}
示例13: extractUserList
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
private List<String> extractUserList(Object result)
{
if (!(result instanceof TabularDataSupport))
{
return null;
}
TabularDataSupport tabularData = (TabularDataSupport)result;
Collection<Object> records = tabularData.values();
List<String> list = new ArrayList<String>();
for (Object o : records)
{
CompositeData data = (CompositeData) o;
if (data.containsKey(USERNAME))
{
list.add(data.get(USERNAME).toString());
}
}
return list;
}
示例14: channels
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
/**
* Creates the list of channels in tabular form from the _channelMap.
*
* @return list of channels in tabular form.
* @throws OpenDataException
*/
public TabularData channels() throws OpenDataException
{
TabularDataSupport channelsList = new TabularDataSupport(_channelsType);
List<AMQChannel> list = _protocolSession.getChannels();
for (AMQChannel channel : list)
{
Object[] itemValues =
{
channel.getChannelId(), channel.isTransactional(),
(channel.getDefaultQueue() != null) ? channel.getDefaultQueue().getNameShortString().asString() : null,
channel.getUnacknowledgedMessageMap().size(), channel.getBlocking()
};
CompositeData channelData = new CompositeDataSupport(_channelType,
COMPOSITE_ITEM_NAMES_DESC.toArray(new String[COMPOSITE_ITEM_NAMES_DESC.size()]), itemValues);
channelsList.put(channelData);
}
return channelsList;
}
示例15: getSystemProperties
import javax.management.openmbean.TabularDataSupport; //導入依賴的package包/類
/**
*
* @return
* @throws ControllerOperationException
*/
public Hashtable getSystemProperties() throws ControllerOperationException {
try {
Hashtable table = new Hashtable();
TabularDataSupport tds = (TabularDataSupport) con.getAttribute(
new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME),
"SystemProperties");
for (Iterator it = tds.values().iterator(); it.hasNext(); ) {
CompositeDataSupport cds = (CompositeDataSupport) it.next();
Collection col = (Collection) cds.values();
for (Iterator iter = col.iterator(); iter.hasNext(); ) {
table.put(iter.next(), iter.next());
}
}
return table;
} catch(Exception e) {
ControllerOperationException coe = new ControllerOperationException(
e.getMessage());
coe.initCause(e);
throw coe;
}
}