Package com.sun.appserv.management.base

Examples of com.sun.appserv.management.base.NotificationEmitterService


  private static final String TEST_VALUE  = "test value";
 
    public void
  testEmit()
  {
    final NotificationEmitterService  nes  = getNotificationEmitterService();
   
    final NotificationBuilder  builder  =
      new NotificationBuilder( testEmitListener.TEST_TYPE, TEST_SOURCE );
   
    final testEmitListener  listener  = new testEmitListener();
    nes.addNotificationListener( listener, null, null);
    final Notification  notif  = builder.buildNew( TEST_MESSAGE);
    builder.putMapData( notif, TEST_KEY, TEST_VALUE );
   
    // call emitNotification() and verify it was emitted
    nes.emitNotification( notif );
    while( listener.getLast() == null )
    {
      // wait...
      mySleep( 20 );
    }
    final Notification  retrieved  = listener.getLast();
    assert( retrieved.getType().equals( notif.getType() ) );
    assert( Util.getAMXNotificationValue( retrieved, TEST_KEY, String.class).equals( TEST_VALUE ) );
    assert( retrieved.getSource().equals( TEST_SOURCE ) );
    assert( retrieved.getMessage().equals( TEST_MESSAGE ) );
   
    // now emit many Notifications.
    listener.clear();
    long  start  = now();
    final int  ITER  = 200;
    for( int i = 0; i < ITER; ++i)
    {
      final Notification  temp  = builder.buildNew( TEST_MESSAGE);
        builder.putMapData( notif, TEST_KEY, TEST_VALUE );
      nes.emitNotification( temp );
    }
    printElapsedIter( "Emitted Notifications", start, ITER );
    start  = now();
    while( listener.getNumHeard() < ITER )
    {
View Full Code Here


    final ObjectName  childObjectName  =
      objectNames.buildContaineeObjectName( getObjectName(),
        getFullType(), XTypes.NOTIFICATION_EMITTER_SERVICE,
          NotificationEmitterServiceKeys.DOMAIN_KEY);
   
    final NotificationEmitterService  domainNES  = new NotificationEmitterServiceImpl();
    try
    {
      getMBeanServer().registerMBean( domainNES, childObjectName );
    }
    catch( JMException e )
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.base.NotificationEmitterService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.