Path: blob/master/src/java.management/share/classes/com/sun/jmx/mbeanserver/DynamicMBean2.java
41161 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jmx.mbeanserver;2627import javax.management.DynamicMBean;28import javax.management.MBeanServer;29import javax.management.ObjectName;3031/**32* A dynamic MBean that wraps an underlying resource. A version of this33* interface might eventually appear in the public JMX API.34*35* @since 1.636*/37public interface DynamicMBean2 extends DynamicMBean {38/**39* The resource corresponding to this MBean. This is the object whose40* class name should be reflected by the MBean's41* getMBeanInfo().getClassName() for example. For a "plain"42* DynamicMBean it will be "this". For an MBean that wraps another43* object, like javax.management.StandardMBean, it will be the wrapped44* object.45*/46public Object getResource();4748/**49* The name of this MBean's class, as used by permission checks.50* This is typically equal to getResource().getClass().getName().51* This method is typically faster, sometimes much faster,52* than getMBeanInfo().getClassName(), but should return the same53* result.54*/55public String getClassName();5657/**58* Additional registration hook. This method is called after59* {@link javax.management.MBeanRegistration#preRegister preRegister}.60* Unlike that method, if it throws an exception and the MBean implements61* {@code MBeanRegistration}, then {@link62* javax.management.MBeanRegistration#postRegister postRegister(false)}63* will be called on the MBean. This is the behavior that the MBean64* expects for a problem that does not come from its own preRegister65* method.66*/67public void preRegister2(MBeanServer mbs, ObjectName name)68throws Exception;6970/**71* Additional registration hook. This method is called if preRegister72* and preRegister2 succeed, but then the MBean cannot be registered73* (for example because there is already another MBean of the same name).74*/75public void registerFailed();76}777879