public abstract class AbstractServerDetector extends Object implements ServerDetector
Constructor and Description |
---|
AbstractServerDetector() |
Modifier and Type | Method and Description |
---|---|
void |
addMBeanServers(Set<MBeanServerConnection> pServers)
Do nothing by default, leaving the implementation
optional for each specific detector
|
protected String |
getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,
ObjectName pMBean,
String pAttribute)
Get the string representation of an attribute
|
protected String |
getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,
String pMBean,
String pAttribute)
Get the string representation of an attribute
|
protected String |
getSingleStringAttribute(MBeanServerExecutor pMBeanServerExecutor,
String pMBeanName,
String pAttribute)
Get a single attribute for a given MBeanName pattern.
|
protected String |
getVersionFromJsr77(MBeanServerExecutor pMbeanServers)
Get the version number from a JSR-77 compliant server
|
protected boolean |
isClassLoaded(String className,
Instrumentation instrumentation)
Tests if the given class name has been loaded by the JVM.
|
void |
jvmAgentStartup(Instrumentation instrumentation)
By default do nothing during JVM agent startup
|
protected boolean |
mBeanExists(MBeanServerExecutor pMBeanServerManger,
String pObjectName)
Check whether a certain MBean exists
|
protected Set<ObjectName> |
searchMBeans(MBeanServerExecutor pMBeanServerExecutor,
String pMbeanPattern)
Check for the existence of a certain MBean.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
detect
protected Set<ObjectName> searchMBeans(MBeanServerExecutor pMBeanServerExecutor, String pMbeanPattern)
pMBeanServerExecutor
- mbean servers to query forpMbeanPattern
- MBean name pattern for MBeans to check forObjectName
s if the pattern matches, or an empty set if not mbean has been foundprotected boolean mBeanExists(MBeanServerExecutor pMBeanServerManger, String pObjectName)
pMBeanServerManger
- set of MBeanServers to query forpObjectName
- the objectname to check. Can be a pattern in which case this method
return true if one or more MBeans of all MBeanServers match this patternprotected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, String pMBean, String pAttribute)
pMBeanServerExecutor
- set of MBeanServers to query. The first one wins.pMBean
- object name of MBean to lookuppAttribute
- attribute to lookupnull
if the attribute could not be fetchedprotected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, ObjectName pMBean, String pAttribute)
pMBeanServerExecutor
- set of MBeanServers to query. The first one wins.pMBean
- name of MBean to lookuppAttribute
- attribute to lookupnull
if the attribute could not be fetchedprotected String getSingleStringAttribute(MBeanServerExecutor pMBeanServerExecutor, String pMBeanName, String pAttribute)
pMBeanServerExecutor
- MBeanServer manager to querypMBeanName
- a MBean name or pattern. If multiple MBeans are found, each is queried for the attributepAttribute
- the attribute to lookupprotected String getVersionFromJsr77(MBeanServerExecutor pMbeanServers)
pMbeanServers
- servers to querypublic void addMBeanServers(Set<MBeanServerConnection> pServers)
addMBeanServers
in interface ServerDetector
pServers
- servers to addpublic void jvmAgentStartup(Instrumentation instrumentation)
jvmAgentStartup
in interface ServerDetector
instrumentation
- the Instrumentation implementationprotected boolean isClassLoaded(String className, Instrumentation instrumentation)
className
- the name of the class to checkinstrumentation
- IllegalArgumentException
- in case instrumentation or the provided class is nullCopyright © 2017. All rights reserved.