本文整理汇总了Java中javax.management.ObjectName.getKeyPropertyList方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectName.getKeyPropertyList方法的具体用法?Java ObjectName.getKeyPropertyList怎么用?Java ObjectName.getKeyPropertyList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.ObjectName
的用法示例。
在下文中一共展示了ObjectName.getKeyPropertyList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findChildren
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Finds all children runtime beans, same properties and values as current root
* + any number of additional properties.
*/
private Set<ObjectName> findChildren(ObjectName innerRootBean, Set<ObjectName> childRbeOns) {
final Map<String, String> wantedProperties = innerRootBean.getKeyPropertyList();
return Sets.newHashSet(Collections2.filter(childRbeOns, on -> {
Map<String, String> localProperties = on.getKeyPropertyList();
for (Entry<String, String> propertyEntry : wantedProperties.entrySet()) {
if (!localProperties.containsKey(propertyEntry.getKey())) {
return false;
}
if (!localProperties.get(propertyEntry.getKey()).equals(propertyEntry.getValue())) {
return false;
}
if (localProperties.size() <= wantedProperties.size()) {
return false;
}
}
return true;
}));
}
示例2: createObjectName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Creates the ObjectName for the ConnectionPoolMBean object to be registered
* @param original the ObjectName for the DataSource
* @return the ObjectName for the ConnectionPoolMBean
* @throws MalformedObjectNameException
*/
public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException {
String domain = ConnectionPool.POOL_JMX_DOMAIN;
Hashtable<String,String> properties = original.getKeyPropertyList();
String origDomain = original.getDomain();
properties.put("type", "ConnectionPool");
properties.put("class", this.getClass().getName());
if (original.getKeyProperty("path")!=null || properties.get("context")!=null) {
//this ensures that if the registration came from tomcat, we're not losing
//the unique domain, but putting that into as an engine attribute
properties.put("engine", origDomain);
}
ObjectName name = new ObjectName(domain,properties);
return name;
}
示例3: ObjectNamePattern
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Builds a new ObjectNamePattern object from an ObjectName pattern.
* @param pattern The ObjectName pattern under examination.
**/
public ObjectNamePattern(ObjectName pattern) {
this(pattern.isPropertyListPattern(),
pattern.isPropertyValuePattern(),
pattern.getCanonicalKeyPropertyListString(),
pattern.getKeyPropertyList(),
pattern);
}
示例4: of
import javax.management.ObjectName; //导入方法依赖的package包/类
@SuppressWarnings("StaticMethodNamingConvention")
public static @NotNull Optional<MBean> of(@NotNull ObjectName name, @NotNull MBeanAttributeInfo info) {
final Map<String, String> properties = name.getKeyPropertyList();
final String type = properties.get(TYPE_PROPERTY_NAME);
if (type == null) {
return Optional.empty();
}
final Map<String, String> labels = properties.entrySet().stream()
.filter(entry -> !entry.getKey().equals(TYPE_PROPERTY_NAME))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
return Optional.of(new MBean(name.getDomain() + ':' + type, info.getName(), labels));
}
示例5: getAdditionalProperties
import javax.management.ObjectName; //导入方法依赖的package包/类
public static Map<String, String> getAdditionalProperties(final ObjectName on) {
Map<String, String> keyPropertyList = on.getKeyPropertyList();
Map<String, String> result = new HashMap<>();
for (Entry<String, String> entry : keyPropertyList.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
示例6: appendIdentityToObjectName
import javax.management.ObjectName; //导入方法依赖的package包/类
/**
* Append an additional key/value pair to an existing {@link ObjectName} with the key being
* the static value {@code identity} and the value being the identity hash code of the
* managed resource being exposed on the supplied {@link ObjectName}. This can be used to
* provide a unique {@link ObjectName} for each distinct instance of a particular bean or
* class. Useful when generating {@link ObjectName ObjectNames} at runtime for a set of
* managed resources based on the template value supplied by a
* {@link org.springframework.jmx.export.naming.ObjectNamingStrategy}.
* @param objectName the original JMX ObjectName
* @param managedResource the MBean instance
* @return an ObjectName with the MBean identity added
* @throws MalformedObjectNameException in case of an invalid object name specification
* @see org.springframework.util.ObjectUtils#getIdentityHexString(Object)
*/
public static ObjectName appendIdentityToObjectName(ObjectName objectName, Object managedResource)
throws MalformedObjectNameException {
Hashtable<String, String> keyProperties = objectName.getKeyPropertyList();
keyProperties.put(IDENTITY_OBJECT_NAME_KEY, ObjectUtils.getIdentityHexString(managedResource));
return ObjectNameManager.getInstance(objectName.getDomain(), keyProperties);
}