本文整理匯總了Java中javax.management.openmbean.TabularDataSupport.put方法的典型用法代碼示例。如果您正苦於以下問題:Java TabularDataSupport.put方法的具體用法?Java TabularDataSupport.put怎麽用?Java TabularDataSupport.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.management.openmbean.TabularDataSupport
的用法示例。
在下文中一共展示了TabularDataSupport.put方法的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: 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;
}
示例4: 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;
}
示例5: tabularData
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public static TabularData tabularData(final String typeName, final String typeDescription, final String[] names, final Object[] values) {
if (names.length == 0) {
return null;
}
final OpenType<?>[] types = new OpenType<?>[names.length];
for (int i = 0; i < types.length; i++) {
types[i] = SimpleType.STRING;
}
try {
final CompositeType ct = new CompositeType(typeName, typeDescription, names, names, types);
final TabularType type = new TabularType(typeName, typeDescription, ct, names);
final TabularDataSupport data = new TabularDataSupport(type);
final CompositeData line = new CompositeDataSupport(ct, names, values);
data.put(line);
return data;
} catch (final OpenDataException e) {
return null;
}
}
示例6: toTabularData
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
private TabularData toTabularData(final String typeName, final String description, final Table table)
{
final OpenType<?>[] types = new OpenType<?>[table.getColumnNames().size()];
for (int i = 0; i < types.length; i++)
{
types[i] = SimpleType.STRING;
}
try
{
final String[] keys = table.getColumnNames().toArray(new String[table.getColumnNames().size()]);
final CompositeType ct = new CompositeType(
typeName, description, keys, keys, types);
final TabularType type = new TabularType(typeName, description, ct, keys);
final TabularDataSupport data = new TabularDataSupport(type);
for (final Collection<String> line : table.getLines())
{
data.put(new CompositeDataSupport(ct, keys, line.toArray(new Object[line.size()])));
}
return data;
}
catch (final OpenDataException e)
{
throw new IllegalArgumentException(e);
}
}
示例7: from
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public static TabularData from(JsonArray resultSet) throws OpenDataException {
TabularDataSupport result = new TabularDataSupport(TABULAR_TYPE);
for (int i = 0; i < resultSet.size(); i++) {
JsonObject row = resultSet.getJsonObject(i);
String id = row.getString("id");
String ksName = row.getString("ks");
String cfName = row.getString("cf");
long compactedAt = row.getJsonNumber("compacted_at").longValue();
long bytesIn = row.getJsonNumber("bytes_in").longValue();
long bytesOut = row.getJsonNumber("bytes_out").longValue();
JsonArray merged = row.getJsonArray("rows_merged");
StringBuilder sb = new StringBuilder();
if (merged != null) {
sb.append('{');
for (int m = 0; m < merged.size(); m++) {
JsonObject entry = merged.getJsonObject(m);
if (m > 0) {
sb.append(',');
}
sb.append(entry.getString("key")).append(':').append(entry.getString("value"));
}
sb.append('}');
}
result.put(new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
new Object[] { id, ksName, cfName, compactedAt, bytesIn, bytesOut, sb.toString() }));
}
return result;
}
示例8: from
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public static void from(final String snapshot, final String ks, final String cf,
Map.Entry<String, Pair<Long, Long>> snapshotDetail, TabularDataSupport result) {
try {
final String totalSize = FileUtils.stringifyFileSize(snapshotDetail.getValue().left);
final String liveSize = FileUtils.stringifyFileSize(snapshotDetail.getValue().right);
result.put(new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
new Object[] { snapshot, ks, cf, liveSize, totalSize }));
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
示例9: health
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
@Override
public TabularData health() throws Exception {
OpenTypeSupport.OpenTypeFactory factory = OpenTypeSupport.getFactory(HealthStatus.class);
CompositeType ct = factory.getCompositeType();
TabularType tt = new TabularType("HealthStatus", "HealthStatus", ct, new String[]{"healthId", "level", "message", "resource"});
TabularDataSupport rc = new TabularDataSupport(tt);
List<HealthStatus> list = healthList();
for (HealthStatus healthStatus : list) {
rc.put(new CompositeDataSupport(ct, factory.getFields(healthStatus)));
}
return rc;
}
示例10: getSlowConsumers
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public TabularData getSlowConsumers() throws OpenDataException {
OpenTypeSupport.OpenTypeFactory factory = OpenTypeSupport.getFactory(SlowConsumerEntry.class);
CompositeType ct = factory.getCompositeType();
TabularType tt = new TabularType("SlowConsumers", "Table of current slow Consumers", ct, new String[] {"subscription" });
TabularDataSupport rc = new TabularDataSupport(tt);
int index = 0;
Map<Subscription, SlowConsumerEntry> slowConsumers = strategy.getSlowConsumers();
for (Map.Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) {
entry.getValue().setSubscription(broker.getSubscriberObjectName(entry.getKey()));
rc.put(OpenTypeSupport.convert(entry.getValue()));
}
return rc;
}
示例11: browseAsTable
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public TabularData browseAsTable(SubscriptionView view) throws OpenDataException {
OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
List<Message> messages = getSubscriberMessages(view);
CompositeType ct = factory.getCompositeType();
TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] {"JMSMessageID"});
TabularDataSupport rc = new TabularDataSupport(tt);
for (int i = 0; i < messages.size(); i++) {
rc.put(new CompositeDataSupport(ct, factory.getFields(messages.get(i))));
}
return rc;
}
示例12: browseAsTable
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
@Override
public TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException {
OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
Message[] messages = destination.browse();
CompositeType ct = factory.getCompositeType();
TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] { "JMSMessageID" });
TabularDataSupport rc = new TabularDataSupport(tt);
MessageEvaluationContext ctx = new MessageEvaluationContext();
ctx.setDestination(destination.getActiveMQDestination());
BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);
for (int i = 0; i < messages.length; i++) {
try {
if (selectorExpression == null) {
rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i])));
} else {
ctx.setMessageReference(messages[i]);
if (selectorExpression.matches(ctx)) {
rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i])));
}
}
} catch (Throwable e) {
LOG.warn("exception browsing destination", e);
}
}
return rc;
}
示例13: toJmxTable
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
public TabularData toJmxTable() throws OpenDataException {
TabularDataSupport result = new TabularDataSupport( CALL_LOG_TYPE );
for ( CallLogEntry entry : entries ) {
result.put( entry.toTableRow() );
}
return result;
}
示例14: viewUsers
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
@MBeanOperation(name = "viewUsers", description = "All users that are currently available to the system.")
public TabularData viewUsers()
{
List<Principal> users = _principalDatabase.getUsers();
TabularDataSupport userList = new TabularDataSupport(_userlistDataType);
try
{
// Create the tabular list of message header contents
for (Principal user : users)
{
// Create header attributes list
// Read,Write,Admin items are depcreated and we return always false.
Object[] itemData = {user.getName(), false, false, false};
CompositeData messageData = new CompositeDataSupport(_userDataType, COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), itemData);
userList.put(messageData);
}
}
catch (OpenDataException e)
{
_logger.warn("Unable to create user list due to :", e);
return null;
}
return userList;
}
示例15: getActiveRoutes
import javax.management.openmbean.TabularDataSupport; //導入方法依賴的package包/類
@ManagedAttribute
public TabularData getActiveRoutes() {
if (routes.length == 0) {
return null;
}
final OpenType<?>[] types = new OpenType<?>[routes.length];
final String[] keys = new String[types.length];
final String[] values = new String[types.length];
for (int i = 0; i < types.length; i++) {
types[i] = SimpleType.STRING;
keys[i] = routes[i].getOrigin().substring(prefix.length());
values[i] = routes[i].getRawDestination().substring(prefix.length());
}
try {
final CompositeType ct = new CompositeType("routes", "routes", keys, keys, types);
final TabularType type = new TabularType("router", "routes", ct, keys);
final TabularDataSupport data = new TabularDataSupport(type);
final CompositeData line = new CompositeDataSupport(ct, keys, values);
data.put(line);
return data;
} catch (final OpenDataException e) {
return null;
}
}