Issue #2727 - Revisit JMX MBean lookup behavior.

Fixed invoke() lookup.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-09-24 10:49:29 +02:00
parent 87aba86d74
commit 92e70f2c84
4 changed files with 25 additions and 18 deletions

View File

@ -9,4 +9,4 @@
#org.eclipse.jetty.server.LEVEL=DEBUG
#org.eclipse.jetty.servlets.LEVEL=DEBUG
#org.eclipse.jetty.alpn.LEVEL=DEBUG
org.eclipse.jetty.jmx.LEVEL=DEBUG
#org.eclipse.jetty.jmx.LEVEL=DEBUG

View File

@ -159,12 +159,11 @@ public class MBeanContainer implements Container.InheritedListener, Dumpable, De
LOG.debug("MBean for {} is {}", o, mbean);
if (mbean instanceof ObjectMBean)
{
MBeanInfo info =((ObjectMBean)mbean).getMBeanInfo();
for (Object a :info.getAttributes())
LOG.debug(" {}", a);
for (Object a :info.getOperations())
LOG.debug(" {}", a);
MBeanInfo info = ((ObjectMBean)mbean).getMBeanInfo();
for (Object a : info.getAttributes())
LOG.debug(" {}", a);
for (Object a : info.getOperations())
LOG.debug(" {}", a);
}
}
return mbean;

View File

@ -154,18 +154,26 @@ class MetaData
private OperationInfo findOperation(String signature)
{
OperationInfo result = _operations.get(signature);
if (result != null)
return result;
OperationInfo result = null;
for (MetaData intf : _interfaces)
{
result = intf.findOperation(signature);
if (result != null)
return result;
OperationInfo r = intf.findOperation(signature);
if (r != null)
result = r;
}
if (_parent != null)
return _parent.findOperation(signature);
return null;
{
OperationInfo r = _parent.findOperation(signature);
if (r != null)
result = r;
}
OperationInfo r = _operations.get(signature);
if (r != null)
result = r;
return result;
}
private static Object newInstance(Constructor<?> constructor, Object bean)
@ -385,7 +393,7 @@ class MetaData
void setAttribute(Object value, ObjectMBean mbean) throws ReflectionException, MBeanException
{
if (LOG.isDebugEnabled())
LOG.debug("setAttribute {}.{}={} {}",mbean,_info.getName(), value, _info);
LOG.debug("setAttribute {}.{}={} {}", mbean, _info.getName(), value, _info);
try
{
if (_setter == null)
@ -496,7 +504,7 @@ class MetaData
public Object invoke(Object[] args, ObjectMBean mbean) throws ReflectionException, MBeanException
{
if (LOG.isDebugEnabled())
LOG.debug("invoke {}.{}({}) {}",mbean,_info.getName(), Arrays.asList(args), _info);
LOG.debug("invoke {}.{}({}) {}", mbean, _info.getName(), Arrays.asList(args), _info);
try
{
Object target = mbean.getManagedObject();

View File

@ -226,7 +226,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
}
@Override
@ManagedAttribute
@ManagedAttribute("The connection idle timeout in milliseconds")
public long getIdleTimeout()
{
return _idleTimeout;