MethodInterceptor that routes calls to an
MBean running on the supplied MBeanServerConnection.
Works for both local and remote MBeanServerConnections.
By default, the MBeanClientInterceptor will connect to the
MBeanServer and cache MBean metadata at startup. This can
be undesirable when running against a remote MBeanServer
that may not be running when the application starts. Through setting the
connectOnStartup property to "false",
you can defer this process until the first invocation against the proxy.
This functionality is usually used through MBeanProxyFactoryBean.
See the javadoc of that class for more information.
Set the management interface of the target MBean, exposing bean property
setters and getters for MBean attributes and conventional Java methods
for MBean operations.
@Nullable
public java.util.Map<java.lang.String,?> getEnvironment()
Allow Map access to the environment to be set for the connector,
with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"environment[myKey]". This is particularly useful for
adding or overriding entries in child bean definitions.
setAgentId
public void setAgentId(java.lang.String agentId)
Set the agent id of the MBeanServer to locate.
Default is none. If specified, this will result in an
attempt being made to locate the attendant MBeanServer, unless
the "serviceUrl" property has been set.
See Also:
Specifying the empty String indicates the platform MBeanServer.
setConnectOnStartup
public void setConnectOnStartup(boolean connectOnStartup)
Set whether or not the proxy should connect to the MBeanServer
at creation time ("true") or the first time it is invoked ("false").
Default is "true".
setRefreshOnConnectFailure
public void setRefreshOnConnectFailure(boolean refreshOnConnectFailure)
Set whether to refresh the MBeanServer connection on connect failure.
Default is "false".
Can be turned on to allow for hot restart of the JMX server,
automatically reconnecting and retrying in case of an IOException.
setObjectName
public void setObjectName(java.lang.Object objectName)
throws javax.management.MalformedObjectNameException
Set the ObjectName of the MBean which calls are routed to,
as ObjectName instance or as String.
Throws:
javax.management.MalformedObjectNameException
setUseStrictCasing
public void setUseStrictCasing(boolean useStrictCasing)
Set whether to use strict casing for attributes. Enabled by default.
When using strict casing, a JavaBean property with a getter such as
getFoo() translates to an attribute called Foo.
With strict casing disabled, getFoo() would translate to just
foo.
setManagementInterface
public void setManagementInterface(@Nullable
java.lang.Class<?> managementInterface)
Set the management interface of the target MBean, exposing bean property
setters and getters for MBean attributes and conventional Java methods
for MBean operations.
getManagementInterface
@Nullable
protected final java.lang.Class<?> getManagementInterface()
Return the management interface of the target MBean,
or null if none specified.
setBeanClassLoader
public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
Route the invocation to the configured managed resource. Correctly routes JavaBean property
access to MBeanServerConnection.get/setAttribute and method invocation to
MBeanServerConnection.invoke.
Parameters:
invocation - the MethodInvocation to re-route
Returns:
the value returned as a result of the re-routed invocation
Throws:
java.lang.Throwable - an invocation error propagated to the user