@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
@@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.jmx.MBeanServerNotFoundException ;
import org.springframework.lang.Nullable ;
import org.springframework.util.ClassUtils ;
import org.springframework.util.CollectionUtils ;
import org.springframework.util.ObjectUtils ;
import org.springframework.util.StringUtils ;
@ -69,8 +70,7 @@ public abstract class JmxUtils {
@@ -69,8 +70,7 @@ public abstract class JmxUtils {
* { @code MBeanServer } can be found . Logs a warning if more than one
* { @code MBeanServer } found , returning the first one from the list .
* @return the { @code MBeanServer } if found
* @throws org . springframework . jmx . MBeanServerNotFoundException
* if no { @code MBeanServer } could be found
* @throws MBeanServerNotFoundException if no { @code MBeanServer } could be found
* @see javax . management . MBeanServerFactory # findMBeanServer
* /
public static MBeanServer locateMBeanServer ( ) throws MBeanServerNotFoundException {
@ -85,8 +85,7 @@ public abstract class JmxUtils {
@@ -85,8 +85,7 @@ public abstract class JmxUtils {
* If this parameter is { @code null } , all registered MBeanServers are considered .
* If the empty String is given , the platform MBeanServer will be returned .
* @return the { @code MBeanServer } if found
* @throws org . springframework . jmx . MBeanServerNotFoundException
* if no { @code MBeanServer } could be found
* @throws MBeanServerNotFoundException if no { @code MBeanServer } could be found
* @see javax . management . MBeanServerFactory # findMBeanServer ( String )
* /
public static MBeanServer locateMBeanServer ( @Nullable String agentId ) throws MBeanServerNotFoundException {
@ -95,7 +94,7 @@ public abstract class JmxUtils {
@@ -95,7 +94,7 @@ public abstract class JmxUtils {
// null means any registered server, but "" specifically means the platform server
if ( ! "" . equals ( agentId ) ) {
List < MBeanServer > servers = MBeanServerFactory . findMBeanServer ( agentId ) ;
if ( servers ! = null & & ! servers . isEmpty ( ) ) {
if ( ! CollectionUtils . isEmpty ( servers ) ) {
// Check to see if an MBeanServer is registered.
if ( servers . size ( ) > 1 & & logger . isWarnEnabled ( ) ) {
logger . warn ( "Found more than one MBeanServer instance" +