本文整理匯總了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);
}