Methods Summary |
---|
public void | addAttribute(java.lang.String name, java.lang.Object value)
if ( name == null || name.length() == 0 )
{
debug( "Illegal Attribute name: " + name );
throw new IllegalArgumentException( );
}
mAttributes.put( name, value );
mMBeanInfo = null;
debug( "added Attribute: " + name );
|
public void | addNotificationListener(javax.management.NotificationListener listener)
mBroadcaster.addNotificationListener( listener, null, null );
|
public void | addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
mBroadcaster.addNotificationListener( listener, filter, handback );
|
private synchronized javax.management.MBeanInfo | createMBeanInfo()
debug( "createMBeanInfo");
final MBeanInfo baseMBeanInfo =
MBeanInfoConverter.getInstance().convert( TestDummy.class, null );
final List<MBeanAttributeInfo> dynamicAttrInfos = new ArrayList<MBeanAttributeInfo>();
int i = 0;
for( final String name : mAttributes.keySet() )
{
final Object value = mAttributes.get( name );
final String type = value == null ?
String.class.getName() : value.getClass().getName();
final MBeanAttributeInfo info =
new MBeanAttributeInfo( name, type, "dynamically-added Attribute",
true, true, false );
dynamicAttrInfos.add( info );
}
final MBeanAttributeInfo[] dynInfos = new MBeanAttributeInfo[ dynamicAttrInfos.size() ];
dynamicAttrInfos.toArray( dynInfos );
final MBeanAttributeInfo[] attrInfos =
JMXUtil.mergeMBeanAttributeInfos( dynInfos, baseMBeanInfo.getAttributes() );
return( JMXUtil.newMBeanInfo( baseMBeanInfo, attrInfos ) );
|
private void | debug(java.lang.Object o)
mDebug.println( o );
|
public long | emitNotifications(java.lang.String notifType, int howMany)
final NotificationBuilder builder =
new NotificationBuilder( notifType, mSelfObjectName );
final long start = System.currentTimeMillis();
for( int i = 0; i < howMany; ++i )
{
final Notification notif = builder.buildNew( "test Notification" );
sendNotification( notif );
}
final long elapsed = System.currentTimeMillis() - start;
return elapsed;
|
public java.lang.String | getAttr1()
return (String)mAttributes.get( "Attr1" );
|
public java.lang.String | getAttr2()
return (String)mAttributes.get( "Attr2" );
|
public java.lang.Object | getAttribute(java.lang.String name)
if ( ! mAttributes.containsKey( name ) )
{
throw new AttributeNotFoundException( name );
}
return( mAttributes.get( name ) );
|
public javax.management.AttributeList | getAttributes(java.lang.String[] names)
final AttributeList attrs = new AttributeList();
if ( names != null )
{
for( int i = 0; i < names.length; ++i )
{
try
{
final Object result = getAttribute( names[ i ] );
attrs.add( new Attribute( names[ i ], result ) );
}
catch( AttributeNotFoundException e )
{
}
}
}
return attrs;
|
private java.lang.String | getDebugID()
return this.getClass().getName();
|
public synchronized javax.management.MBeanInfo | getMBeanInfo()
if ( mMBeanInfo == null )
{
mMBeanInfo = createMBeanInfo();
}
return( mMBeanInfo );
|
public javax.management.MBeanNotificationInfo[] | getNotificationInfo()
return new MBeanNotificationInfo[0];
|
public java.lang.Object | invoke(java.lang.String methodName, java.lang.Object[] args, java.lang.String[] signature)
Object result = null;
if(args == null)
throw new RuntimeException("internal Error -- no args");
final int numArgs = args.length;
if ( "addAttribute".equals( methodName ) && numArgs == 2 )
{
addAttribute( (String)args[ 0 ], (Object)args[ 1 ] );
}
else if ( "removeAttribute".equals( methodName ) && numArgs == 1 )
{
removeAttribute( (String)args[ 0 ] );
}
else if ( numArgs == 2 &&
"emitNotifications".equals( methodName ) )
{
final String type = (String)args[0];
final int howMany = (Integer)args[1];
result = emitNotifications( type, howMany );
}
else
{
throw new RuntimeException( "invoke: no such method " + methodName );
}
return result;
|
public void | postDeregister()
|
public void | postRegister(java.lang.Boolean registrationSucceeded)
|
public void | preDeregister()
|
public javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName nameIn)
mServer = server;
mSelfObjectName = preRegisterModifyName( server, nameIn );
return( mSelfObjectName );
|
protected javax.management.ObjectName | preRegisterModifyName(javax.management.MBeanServer server, javax.management.ObjectName nameIn)
//final String EXTRA = ",epoch=" + System.currentTimeMillis();
final String EXTRA = "";
final ObjectName nameOut = Util.newObjectName( nameIn.toString() + EXTRA );
return( nameOut );
|
public void | removeAttribute(java.lang.String name)
mAttributes.remove( name );
mMBeanInfo = null;
debug( "removed Attribute: " + name );
|
public void | removeNotificationListener(javax.management.NotificationListener listener)
mBroadcaster.removeNotificationListener( listener );
|
public void | removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
mBroadcaster.removeNotificationListener( listener, filter, handback );
|
public void | sendNotification(javax.management.Notification notification)
mBroadcaster.sendNotification( notification );
|
public void | setAttr1(java.lang.String value)
setAttribute( "Attr1", value);
|
public void | setAttr2(java.lang.String value)
setAttribute( "Attr2", value);
|
public void | setAttribute(java.lang.String name, java.lang.Object value)
debug( "setAttribute" + name + "=" + value );
addAttribute( name, value );
|
public void | setAttribute(javax.management.Attribute attr)
setAttribute( attr.getName(), attr.getValue() );
|
public javax.management.AttributeList | setAttributes(javax.management.AttributeList attrs)
throw new RuntimeException(
"TestDummy: setAttributes() not yet implemented" );
|