本文整理汇总了Java中javax.management.InstanceNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java InstanceNotFoundException类的具体用法?Java InstanceNotFoundException怎么用?Java InstanceNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InstanceNotFoundException类属于javax.management包,在下文中一共展示了InstanceNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public Object invoke(ObjectName name, String operationName,
Object params[], String signature[])
throws InstanceNotFoundException, MBeanException,
ReflectionException {
name = nonDefaultDomain(name);
DynamicMBean instance = getMBean(name);
checkMBeanPermission(instance, operationName, name, "invoke");
try {
return instance.invoke(operationName, params, signature);
} catch (Throwable t) {
rethrowMaybeMBeanException(t);
throw new AssertionError();
}
}
示例2: addListenerWithSubject
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
private Integer addListenerWithSubject(ObjectName name,
MarshalledObject<NotificationFilter> filter,
Subject delegationSubject,
boolean reconnect)
throws InstanceNotFoundException, IOException {
final boolean debug = logger.debugOn();
if (debug)
logger.debug("addListenerWithSubject",
"(ObjectName,MarshalledObject,Subject)");
final ObjectName[] names = new ObjectName[] {name};
final MarshalledObject<NotificationFilter>[] filters =
Util.cast(new MarshalledObject<?>[] {filter});
final Subject[] delegationSubjects = new Subject[] {
delegationSubject
};
final Integer[] listenerIDs =
addListenersWithSubjects(names,filters,delegationSubjects,
reconnect);
if (debug) logger.debug("addListenerWithSubject","listenerID="
+ listenerIDs[0]);
return listenerIDs[0];
}
示例3: isInstanceOf
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public boolean isInstanceOf(ObjectName name,
String className)
throws InstanceNotFoundException,
IOException {
if (logger.debugOn())
logger.debug("isInstanceOf", "name=" + name +
", className=" + className);
final ClassLoader old = pushDefaultClassLoader();
try {
return connection.isInstanceOf(name,
className,
delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
return connection.isInstanceOf(name,
className,
delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例4: addNotificationListener
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public void addNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException,
IOException {
final boolean debug = logger.debugOn();
if (debug)
logger.debug("addNotificationListener" +
"(ObjectName,NotificationListener,"+
"NotificationFilter,Object)",
"name=" + name
+ ", listener=" + listener
+ ", filter=" + filter
+ ", handback=" + handback);
final Integer listenerID =
addListenerWithSubject(name,
new MarshalledObject<NotificationFilter>(filter),
delegationSubject,true);
rmiNotifClient.addNotificationListener(listenerID, name, listener,
filter, handback,
delegationSubject);
}
示例5: getListener
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
private NotificationListener getListener(ObjectName listener)
throws ListenerNotFoundException {
// ----------------
// Get listener object
// ----------------
DynamicMBean instance;
try {
instance = getMBean(listener);
} catch (InstanceNotFoundException e) {
throw EnvHelp.initCause(
new ListenerNotFoundException(e.getMessage()), e);
}
Object resource = getResource(instance);
if (!(resource instanceof NotificationListener)) {
final RuntimeException exc =
new IllegalArgumentException(listener.getCanonicalName());
final String msg =
"MBean " + listener.getCanonicalName() + " does not " +
"implement " + NotificationListener.class.getName();
throw new RuntimeOperationsException(exc, msg);
}
return (NotificationListener) resource;
}
示例6: getMBeanInfo
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public MBeanInfo getMBeanInfo(ObjectName name)
throws InstanceNotFoundException,
IntrospectionException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name);
final ClassLoader old = pushDefaultClassLoader();
try {
return connection.getMBeanInfo(name, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
return connection.getMBeanInfo(name, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例7: isInstanceOf
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
private static boolean isInstanceOf(final MBeanServer mbs,
final ObjectName name,
final String className) {
PrivilegedExceptionAction<Boolean> act =
new PrivilegedExceptionAction<Boolean>() {
public Boolean run() throws InstanceNotFoundException {
return mbs.isInstanceOf(name, className);
}
};
try {
return AccessController.doPrivileged(act);
} catch (Exception e) {
logger.fine("isInstanceOf", "failed: " + e);
logger.debug("isInstanceOf", e);
return false;
}
}
示例8: getClassLoader
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
/**
* <p>Return the named {@link java.lang.ClassLoader}.
* @param loaderName The ObjectName of the ClassLoader.
* @return The named ClassLoader.
* @exception InstanceNotFoundException if the named ClassLoader
* is not found.
*/
public ClassLoader getClassLoader(ObjectName loaderName)
throws InstanceNotFoundException {
if (loaderName == null) {
checkMBeanPermission((String) null, null, null, "getClassLoader");
return server.getClass().getClassLoader();
}
DynamicMBean instance = getMBean(loaderName);
checkMBeanPermission(instance, null, loaderName, "getClassLoader");
Object resource = getResource(instance);
/* Check if the given MBean is a ClassLoader */
if (!(resource instanceof ClassLoader))
throw new InstanceNotFoundException(loaderName.toString() +
" is not a classloader");
return (ClassLoader) resource;
}
示例9: getMBean
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
/**
* Gets a specific MBean controlled by the DefaultMBeanServerInterceptor.
* The name must have a non-default domain.
*/
private DynamicMBean getMBean(ObjectName name)
throws InstanceNotFoundException {
if (name == null) {
throw new RuntimeOperationsException(new
IllegalArgumentException("Object name cannot be null"),
"Exception occurred trying to get an MBean");
}
DynamicMBean obj = repository.retrieve(name);
if (obj == null) {
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER,
DefaultMBeanServerInterceptor.class.getName(),
"getMBean", name + " : Found no object");
}
throw new InstanceNotFoundException(name.toString());
}
return obj;
}
示例10: getAttributes
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
@Override
public AttributeList getAttributes(ObjectName name, String[] attributes)
throws InstanceNotFoundException, ReflectionException {
AttributeList results = new AttributeList();
for (String attribute : attributes) {
try {
Object value = getAttribute(name, attribute);
Attribute att = new Attribute(attribute, value);
results.add(att);
} catch (Exception e) {
throw new GemFireSecurityException("error getting value of " + attribute + " from " + name,
e);
}
}
return results;
}
示例11: setAttribute
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute name="
+ attribute.getName());
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
示例12: createMBean
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public ObjectInstance createMBean(
String className, ObjectName name, ObjectName loaderName)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException {
return createMBean(className, name, loaderName, null, null);
}
示例13: removeNotificationListener
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
public void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
removeNotificationListener(name, listener, filter, handback, false);
}
示例14: destroyModule
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
@Override
public void destroyModule(final ObjectName objectName)
throws InstanceNotFoundException {
if(objectName != null){
conf4 = null;
}
}
示例15: addNotificationListener
import javax.management.InstanceNotFoundException; //导入依赖的package包/类
@Override
public synchronized void addNotificationListener(ObjectName name, ObjectName listener,
NotificationFilter filter, Object handback)
throws InstanceNotFoundException {
mbs.addNotificationListener(name, listener, filter, handback);
Listener1 l = new Listener1(name, listener, filter, handback);
listeners.add(l);
listeners1.add(l);
}