jdk/test/javax/management/remote/mandatory/notif/RMINotifTest.java
author emcmanus
Wed, 21 Oct 2009 17:33:18 +0200
changeset 4156 acaa49a2768a
parent 1247 b4c26443dee5
child 5506 202f599c92aa
permissions -rw-r--r--
6851617: Remove JSR 255 (JMX API 2.0) from JDK 7 Summary: See http://weblogs.java.net/blog/2009/06/16/jsr-255-jmx-api-20-postponed Reviewed-by: dfuchs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
1247
b4c26443dee5 6754988: Update copyright year
xdono
parents: 1004
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
1004
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    25
 * @test
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 7654321
1004
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    27
 * @summary Tests to receive notifications for opened and closed connections
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
    28
ions
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * @author sjiang
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * @run clean RMINotifTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run build RMINotifTest
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
    32
 * @run main RMINotifTest
1004
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    33
 * @run main RMINotifTest event
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
// java imports
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
1004
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    39
import java.rmi.RemoteException;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    40
import java.rmi.registry.LocateRegistry;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    41
import java.rmi.registry.Registry;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.util.Random;
1004
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    43
import javax.management.MBeanNotificationInfo;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    44
import javax.management.MBeanServer;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    45
import javax.management.MBeanServerConnection;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    46
import javax.management.MBeanServerFactory;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    47
import javax.management.Notification;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    48
import javax.management.NotificationBroadcasterSupport;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    49
import javax.management.NotificationFilterSupport;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    50
import javax.management.NotificationListener;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    51
import javax.management.ObjectInstance;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    52
import javax.management.ObjectName;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    53
import javax.management.remote.JMXConnector;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    54
import javax.management.remote.JMXConnectorFactory;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    55
import javax.management.remote.JMXConnectorServer;
5ba8217eb504 5108776: Add reliable event handling to the JMX API
sjiang
parents: 2
diff changeset
    56
import javax.management.remote.JMXConnectorServerFactory;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import javax.management.remote.JMXServiceURL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
public class RMINotifTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            // create a rmi registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            Registry reg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            int port = 6666;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            final Random r = new Random();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            while(port++<7000) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                    reg = LocateRegistry.createRegistry(++port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                    System.out.println("Creation of rmi registry succeeded. Running on port " + port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                } catch (RemoteException re) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                // no problem
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            if (reg == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                System.out.println("Failed to create a RMI registry, "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                                   "the ports from 6666 to 6999 are all occupied.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            // create a MBeanServer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            MBeanServer server = MBeanServerFactory.createMBeanServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            // create a notif emitter mbean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            ObjectName mbean = new ObjectName ("Default:name=NotificationEmitter");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            server.registerMBean(new NotificationEmitter(), mbean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            // create a rmi server
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            JMXServiceURL url =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                new JMXServiceURL("rmi", null, port,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                                  "/jndi/rmi://:" + port + "/server" + port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            System.out.println("RMIConnectorServer address " + url);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            JMXConnectorServer sServer =
4156
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
    99
                JMXConnectorServerFactory.newJMXConnectorServer(url, null,
acaa49a2768a 6851617: Remove JSR 255 (JMX API 2.0) from JDK 7
emcmanus
parents: 1247
diff changeset
   100
                                                                null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            ObjectInstance ss = server.registerMBean(sServer, new ObjectName("Default:name=RmiConnectorServer"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            sServer.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            // create a rmi client
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            JMXConnector rmiConnection =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                JMXConnectorFactory.newJMXConnector(url, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            rmiConnection.connect(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            MBeanServerConnection client = rmiConnection.getMBeanServerConnection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            // add listener at the client side
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            client.addNotificationListener(mbean, listener, null, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            //ask to send notifs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            Object[] params = new Object[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            String[] signatures = new String[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            params[0] = new Integer(nb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            signatures[0] = "java.lang.Integer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            client.invoke(mbean, "sendNotifications", params, signatures);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            // waiting ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            synchronized (lock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                if (receivedNotifs != nb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                    lock.wait(10000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                    System.out.println(">>> Received notifications..."+receivedNotifs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            // check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            if (receivedNotifs != nb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                System.out.println("The client received all notifications.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            // remove listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            client.removeNotificationListener(mbean, listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            // more test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            NotificationFilterSupport filter = new NotificationFilterSupport();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            Object o = new Object();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            client.addNotificationListener(mbean, listener, filter, o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            client.removeNotificationListener(mbean, listener, filter, o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            sServer.stop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
//          // clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
//          client.unregisterMBean(mbean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
//          rmiConnection.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
//          Thread.sleep(2000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            System.exit(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
//--------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
// private classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
//--------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    private static class Listener implements NotificationListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        public void handleNotification(Notification notif, Object handback) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            if(++receivedNotifs == nb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                synchronized(lock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    lock.notifyAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public static class NotificationEmitter extends NotificationBroadcasterSupport implements NotificationEmitterMBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
//      public NotificationEmitter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
//              super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
// System.out.println("===NotificationEmitter: new instance.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
//      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
         * Returns a NotificationInfo object containing the name of the Java class of the notification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
         * and the notification types sent by this notification broadcaster.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        public MBeanNotificationInfo[] getNotificationInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            MBeanNotificationInfo[] ntfInfoArray  = new MBeanNotificationInfo[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            String[] ntfTypes = new String[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            ntfTypes[0] = myType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            ntfInfoArray[0] = new MBeanNotificationInfo(ntfTypes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                                                        "javax.management.Notification",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                                                        "Notifications sent by the NotificationEmitter");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            return ntfInfoArray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
//      public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
//          super.addNotificationListener(listener, filter, handback);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
//          System.out.println("============NotificationEmitter: add new listener");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
//      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
         * Send a Notification object with the specified times.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
         * The sequence number will be from zero to times-1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
         * @param nb The number of notifications to send
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        public void sendNotifications(Integer nb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            System.out.println("===NotificationEmitter: be asked to send notifications: "+nb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            Notification notif;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            for (int i=1; i<=nb.intValue(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                notif = new Notification(myType, this, i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                sendNotification(notif);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        private String myType = "notification.my_notification";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    public interface NotificationEmitterMBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        public void sendNotifications(Integer nb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    private static NotificationListener listener = new Listener();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    private static int nb = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    private static int receivedNotifs = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    private static int[] lock = new int[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
}