final WebModule webModule = (WebModule)getContainer();
debug( "queryMonitoringPeerFailed: expecting to find " +
MapUtil.toString( propsMap ) );
if ( webModule == null )
{
logWarning(
"ServletImpl.queryMonitoringPeerFailed: " +
"Can't get containing WebModule, my ObjectName = " + getObjectName());
}
ObjectName result = null;
try
{
final WebModuleVirtualServerMonitor webModuleVirtualServerMonitor =
(WebModuleVirtualServerMonitor)webModule.getMonitoringPeer();
if ( webModuleVirtualServerMonitor == null )
{
final ObjectName objectName = Util.getObjectName( webModule );
final String msg = "ServletImpl.queryMonitoringPeerFailed: " +
"Can't get WebModuleVirtualServerMonitor for " +
quote( toString( objectName ));
debug( msg );
logFine( msg );
}
else
{
final Map<String,ServletMonitor> servletMap =
webModuleVirtualServerMonitor.getServletMonitorMap();
final ServletMonitor sm = servletMap.get( getName() );
if ( sm != null )
{
result = Util.getObjectName( sm );
}
else
{
final String servletMonitorNames = CollectionUtil.toString(
Util.toObjectNames( servletMap ).values(), StringUtil.NEWLINE() );
logWarning(
"ServletImpl.queryMonitoringPeerFailed: " +
"Can't find ServletMonitor, my ObjectName = " +
quote( toString( getObjectName() ) ) +
", WebModuleVirtualServerMonitor " +
quote( toString( Util.getObjectName(webModuleVirtualServerMonitor) )) +
" ServletMonitor names:" + StringUtil.NEWLINE() + servletMonitorNames );
}
}
}
catch( Exception e )
{
logWarning( "ServletImpl.queryMonitoringPeerFailed: " + e);
debug( "ServletImpl.queryMonitoringPeerFailed: " + e + "\n" +
ExceptionUtil.getStackTrace( e ) );
}
return result;