@return true for success.
*/
protected final boolean
removeConfigWithFactory( final ObjectName objectName )
{
ConfigFactory factory = null;
boolean attempted = false;
try
{
final AMXConfig amxConfig = getProxy( objectName, AMXConfig.class );
final String interfaceName = getSimpleInterfaceName( amxConfig );
debug( "removeConfigWithFactory: " + objectName );
factory = createConfigFactory( interfaceName );
}
catch( Exception e )
{
debug( ExceptionUtil.toString( e ) );
}
if ( factory != null )
{
attempted = true;
// some factories have remove(), because they remove a singleton
// instance, and some have remove( ObjectName )
try
{
final Method m = factory.getClass().getMethod( "remove", (Class[])null );
if ( m != null )
{
m.invoke( factory, (Object[])null );
}
}
catch( NoSuchMethodException e )
{
factory.remove( objectName );
}
catch( Exception e )
{
throw new RuntimeException( e );
}