本文整理了Java中javax.management.ObjectName.quote()
方法的一些代码示例,展示了ObjectName.quote()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectName.quote()
方法的具体详情如下:
包路径:javax.management.ObjectName
类名称:ObjectName
方法名:quote
暂无
代码示例来源:origin: springside/springside4
private ObjectName createObjectName(String name) {
try {
return new ObjectName(this.domain, "name", name);
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(this.domain, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
logger.warn("Unable to register {}", name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: wildfly/wildfly
public ObjectInstance run() {
try {
final Hashtable<String, String> table = new Hashtable<>();
table.put("name", ObjectName.quote(finalName));
table.put("type", "thread-pool");
return ManagementFactory.getPlatformMBeanServer().registerMBean(mxBean, new ObjectName("jboss.threads", table));
} catch (Throwable ignored) {
}
return null;
}
}, acc);
代码示例来源:origin: apache/kylin
@Override
public ObjectName createName(String type, String domain, String name) {
try {
if (name.startsWith(domain)) {
ObjectName objectName = new ObjectName(name);
return objectName;
}
ObjectName objectName = new ObjectName(domain, "name", name);
if (objectName.isPattern()) {
objectName = new ObjectName(domain, "name", ObjectName.quote(name));
}
return objectName;
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(domain, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register {} {}", type, name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: networknt/light-4j
@Override
public ObjectName createName(String type, String domain, MetricName metricName) {
String name = metricName.getKey();
try {
ObjectName objectName = new ObjectName(domain, "name", name);
if (objectName.isPattern()) {
objectName = new ObjectName(domain, "name", ObjectName.quote(name));
}
return objectName;
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(domain, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register {} {}", type, name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Register an MBean. If the MBean cannot be registered, this method will simply return.
*
* @param serverMXBean the server MBean to register
* @return a handle which may be used to remove the registration
*/
protected static Closeable register(XnioServerMXBean serverMXBean) {
try {
final ObjectName objectName = new ObjectName("org.xnio", ObjectProperties.properties(ObjectProperties.property("type", "Xnio"), ObjectProperties.property("provider", ObjectName.quote(serverMXBean.getProviderName())), ObjectProperties.property("worker", ObjectName.quote(serverMXBean.getWorkerName())), ObjectProperties.property("address", ObjectName.quote(serverMXBean.getBindAddress()))));
MBeanHolder.MBEAN_SERVER.registerMBean(serverMXBean, objectName);
return new MBeanCloseable(objectName);
} catch (Throwable ignored) {
return IoUtils.nullCloseable();
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Register an MBean. If the MBean cannot be registered, this method will simply return.
*
* @param workerMXBean the worker MBean to register
* @return a handle which may be used to remove the registration
*/
protected static Closeable register(XnioWorkerMXBean workerMXBean) {
try {
final ObjectName objectName = new ObjectName("org.xnio", ObjectProperties.properties(ObjectProperties.property("type", "Xnio"), ObjectProperties.property("provider", ObjectName.quote(workerMXBean.getProviderName())), ObjectProperties.property("worker", ObjectName.quote(workerMXBean.getName()))));
MBeanHolder.MBEAN_SERVER.registerMBean(workerMXBean, objectName);
return new MBeanCloseable(objectName);
} catch (Throwable ignored) {
return IoUtils.nullCloseable();
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Register an MBean. If the MBean cannot be registered, this method will simply return.
*
* @param providerMXBean the provider MBean to register
* @return a handle which may be used to remove the registration
*/
protected static Closeable register(XnioProviderMXBean providerMXBean) {
try {
final ObjectName objectName = new ObjectName("org.xnio", ObjectProperties.properties(ObjectProperties.property("type", "Xnio"), ObjectProperties.property("provider", ObjectName.quote(providerMXBean.getName()))));
MBeanHolder.MBEAN_SERVER.registerMBean(providerMXBean, objectName);
return new MBeanCloseable(objectName);
} catch (Throwable ignored) {
return IoUtils.nullCloseable();
}
}
代码示例来源:origin: org.mobicents.servers.jainslee.core/usage
@Override
protected ObjectName generateUsageParametersMBeanObjectName(String name)
throws MalformedObjectNameException, NullPointerException {
String objectNameAsString = UsageMBean.BASE_OBJECT_NAME
+ (name != null ? "," + UsageMBean.USAGE_PARAMETER_SET_NAME_KEY
+ '=' + ObjectName.quote(name) : "") + ','
+ UsageMBean.NOTIFICATION_SOURCE_KEY + '='
+ ProfileTableNotification.USAGE_NOTIFICATION_TYPE + ','
+ ProfileTableNotification.PROFILE_TABLE_NAME_KEY + '='
+ ObjectName.quote(profileTableName);
return new ObjectName(objectNameAsString);
}
代码示例来源:origin: org.glassfish.main.jms/jms-admin
private ObjectName createDestinationConfig(String destinationType,
String destinationName)
throws MalformedObjectNameException,
NullPointerException {
String s = DESTINATION_CONFIG_DOMAIN_TYPE
+ ",desttype="
+ destinationType
+ ",name="
+ ObjectName.quote(destinationName);
ObjectName o = new ObjectName(s);
return (o);
}
代码示例来源:origin: com.linkedin.pegasus/d2
public ObjectName getName(String name) throws MalformedObjectNameException
{
return new ObjectName("com.linkedin.d2:type=" + ObjectName.quote(name));
}
代码示例来源:origin: org.mobicents.servers.jainslee.core/usage
@Override
protected ObjectName generateUsageNotificationManagerMBeanObjectName()
throws MalformedObjectNameException, NullPointerException {
String objectNameAsString = UsageNotificationManagerMBean.BASE_OBJECT_NAME
+ ','
+ UsageMBean.NOTIFICATION_SOURCE_KEY
+ '='
+ ResourceAdaptorEntityNotification.USAGE_NOTIFICATION_TYPE
+ ','
+ ResourceAdaptorEntityNotification.RESOURCE_ADAPTOR_ENTITY_NAME_KEY
+ '=' + ObjectName.quote(entityName);
return new ObjectName(objectNameAsString);
}
代码示例来源:origin: urbanairship/datacube
private ObjectName createMetrics3Name(String domain, String name) throws MalformedObjectNameException {
try {
return new ObjectName(domain, "name", name);
} catch (MalformedObjectNameException e) {
return new ObjectName(domain, "name", ObjectName.quote(name));
}
}
}
代码示例来源:origin: scriptella/scriptella-etl
static ObjectName toObjectName(String url, int n) {
try {
return new ObjectName(MBEAN_NAME_PREFIX + ",url=" + ObjectName.quote(url) + (n > 0 ? ",n=" + n : ""));
} catch (MalformedObjectNameException e) { //Should not happen
throw new IllegalStateException("Cannot set MBean name", e);
}
}
代码示例来源:origin: com.codahale.metrics/metrics-core
private ObjectName createName(String type, String name) {
try {
return new ObjectName(this.name, "name", name);
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(this.name, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register {} {}", type, name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
private ObjectName createName(String type, String name) {
try {
return new ObjectName(this.name, "name", name);
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(this.name, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register {} {}", type, name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: org.jboss.threads/jboss-threads
public ObjectInstance run() {
try {
final Hashtable<String, String> table = new Hashtable<>();
table.put("name", ObjectName.quote(finalName));
table.put("type", "thread-pool");
return ManagementFactory.getPlatformMBeanServer().registerMBean(mxBean, new ObjectName("jboss.threads", table));
} catch (Throwable ignored) {
}
return null;
}
}, acc);
代码示例来源:origin: io.vertx/vertx-dropwizard-metrics
private ObjectName createName(String type, String name) {
try {
return new ObjectName(this.name, "name", name);
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(this.name, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register " + type + " " + name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: io.vertx/vertx-metrics
private ObjectName createName(String type, String name) {
try {
return new ObjectName(this.name, "name", name);
} catch (MalformedObjectNameException e) {
try {
return new ObjectName(this.name, "name", ObjectName.quote(name));
} catch (MalformedObjectNameException e1) {
LOGGER.warn("Unable to register " + type + " " + name, e1);
throw new RuntimeException(e1);
}
}
}
代码示例来源:origin: fusesource/hawtdispatch
static public ObjectName objectName(HawtDispatcher dispatcher) {
try {
return new ObjectName(DISPATCHER_OBJECT_NAME+",name="+ObjectName.quote(dispatcher.getLabel()));
} catch (MalformedObjectNameException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: jboss-fuse/fabric8
void registerMethodMetricsMBean(String threadName, long threadId, int rank, MethodMetricsProxy threadMetrics) {
try {
String threadIdentity = threadName + "[" + threadId + "]";
ObjectName objectName = new ObjectName(DEFAULT_DOMAIN + ":"
+ "type=ThreadContextMetrics"
+ ",threadName=" + ObjectName.quote(threadIdentity)
+ ",rank=" + ObjectName.quote("rank" + rank));
registerMBean(objectName, threadMetrics);
objectNameMap.put(threadMetrics, objectName);
} catch (Throwable e) {
LOG.error("Failed to register mbean " + threadMetrics.toString(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!