/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @summary Test that we can create proxies which are NotificationEmitters.
* @bug 6411747
* @author Daniel Fuchs
* @run clean NotificationEmitterProxy
* @run build NotificationEmitterProxy
* @run main NotificationEmitterProxy
*/
import javax.management.*;
public class NotificationEmitterProxy {
public static class Counter {
int count;
public synchronized int count() {
count++;
notifyAll();
return count;
}
public synchronized int peek() {
return count;
}
throws InterruptedException {
if (rest <= 0) break;
}
return count;
}
}
public static class CounterListener
implements NotificationListener {
}
":\n\t" + notification);
}
}
final JMXConnectorServer server =
final NotificationFilterSupport filter =
new NotificationFilterSupport();
int registered = 0;
try {
final MBeanServerDelegateMBean delegate =
MBeanServerDelegateMBean.class,
true);
} catch (Exception x) {
throw new RuntimeException("Failed to register listener with "+
" JMX.newMBeanProxy: " + x, x);
}
try {
final MBeanServerDelegateMBean delegate =
MBeanServerDelegateMBean.class,
true);
"MBeanServerInvocationHandler.newProxyInstance");
} catch (Exception x) {
throw new RuntimeException("Failed to register listener with "+
" MBeanServerInvocationHandler.newProxyInstance: " + x, x);
}
registered++;
name,
SimpleMXBean.class,
true);
name,
SimpleMXBean.class,
false);
", expected " +expected);
" notifs after registerMBean");
if (mxnotifs != 1)
throw new RuntimeException("Bad MXBean notification count: " +
mxnotifs);
" notifs from MXBean");
" notifs after unregisterMBean");
}
public static interface Simplest {
}
}
implements SimpleMXBean {
return x;
}
}
}