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];
}
java类javax.management.InstanceNotFoundException的实例源码
RMIConnector.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
RMIConnector.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
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);
}
}
RMIConnector.java 文件源码
项目:openjdk-jdk10
阅读 30
收藏 0
点赞 0
评论 0
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);
}
DefaultMBeanServerInterceptor.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
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;
}
DefaultMBeanServerInterceptor.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
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();
}
}
RMIConnector.java 文件源码
项目:jdk8u-jdk
阅读 33
收藏 0
点赞 0
评论 0
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);
}
}
ArrayNotificationBuffer.java 文件源码
项目:jdk8u-jdk
阅读 29
收藏 0
点赞 0
评论 0
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;
}
}
DefaultMBeanServerInterceptor.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
/**
* <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;
}
DefaultMBeanServerInterceptor.java 文件源码
项目:OpenJSharp
阅读 31
收藏 0
点赞 0
评论 0
/**
* 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;
}
MBeanServerWrapper.java 文件源码
项目:monarch
阅读 26
收藏 0
点赞 0
评论 0
@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;
}
DefaultMBeanServerInterceptor.java 文件源码
项目:OpenJSharp
阅读 31
收藏 0
点赞 0
评论 0
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;
}
DefaultMBeanServerInterceptor.java 文件源码
项目:jdk8u-jdk
阅读 30
收藏 0
点赞 0
评论 0
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();
}
}
RMIConnector.java 文件源码
项目:OpenJSharp
阅读 28
收藏 0
点赞 0
评论 0
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];
}
RMIConnector.java 文件源码
项目:jdk8u-jdk
阅读 29
收藏 0
点赞 0
评论 0
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);
}
}
OldMBeanServerTest.java 文件源码
项目:jdk8u-jdk
阅读 24
收藏 0
点赞 0
评论 0
public ObjectInstance createMBean(
String className, ObjectName name, ObjectName loaderName)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException {
return createMBean(className, name, loaderName, null, null);
}
DefaultMBeanServerInterceptor.java 文件源码
项目:jdk8u-jdk
阅读 22
收藏 0
点赞 0
评论 0
public void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
removeNotificationListener(name, listener, filter, handback, false);
}
TestingConfigTransactionController.java 文件源码
项目:hashsdn-controller
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void destroyModule(final ObjectName objectName)
throws InstanceNotFoundException {
if(objectName != null){
conf4 = null;
}
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 25
收藏 0
点赞 0
评论 0
@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);
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 23
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectInstance createMBean(String className, ObjectName name,
ObjectName loaderName, Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException {
throw new UnsupportedOperationException("Not supported by PogamutMBeanServer yet...");
}
JmxMBeanServer.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
public void removeNotificationListener(ObjectName name,
ObjectName listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
mbsInterceptor.removeNotificationListener(cloneObjectName(name),
listener, filter, handback);
}
MBeanServerAccessController.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
/**
* Call <code>checkRead()</code>, then forward this method to the
* wrapped object.
*/
public void removeNotificationListener(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
checkRead();
getMBeanServer().removeNotificationListener(name, listener,
filter, handback);
}
ServiceReferenceRegistryImpl.java 文件源码
项目:hashsdn-controller
阅读 24
收藏 0
点赞 0
评论 0
@Override
public synchronized ObjectName saveServiceReference(final String serviceInterfaceName, final String refName,
final ObjectName moduleON) throws InstanceNotFoundException {
assertWritable();
ServiceReference serviceReference = new ServiceReference(serviceInterfaceName, refName);
return saveServiceReference(serviceReference, moduleON);
}
PogamutMBeanServer.java 文件源码
项目:Pogamut3
阅读 19
收藏 0
点赞 0
评论 0
@Override
public synchronized void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback)
throws InstanceNotFoundException, ListenerNotFoundException {
mbs.removeNotificationListener(name, listener, filter, handback);
Listener1 l = new Listener1(name, listener, filter, handback);
listeners.remove(l);
listeners1.remove(l);
unregisteredListeners.remove(l);
}
OldMBeanServerTest.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
public void unregisterMBean(ObjectName name)
throws InstanceNotFoundException, MBeanRegistrationException {
forbidJMImpl(name);
DynamicMBean mbean = getMBean(name);
if (mbean == null)
throw new InstanceNotFoundException(name.toString());
MBeanRegistration reg = mbeanRegistration(mbean);
try {
reg.preDeregister();
} catch (Exception e) {
throw new MBeanRegistrationException(e);
}
if (!mbeans.remove(name, mbean))
throw new InstanceNotFoundException(name.toString());
// This is incorrect because we've invoked preDeregister
Object userMBean = getUserMBean(mbean);
if (userMBean instanceof ClassLoader)
clr.removeLoader((ClassLoader) userMBean);
Notification n = new MBeanServerNotification(
MBeanServerNotification.REGISTRATION_NOTIFICATION,
MBeanServerDelegate.DELEGATE_NAME,
0,
name);
delegate.sendNotification(n);
reg.postDeregister();
}
MBeanServerAccessController.java 文件源码
项目:OpenJSharp
阅读 33
收藏 0
点赞 0
评论 0
/**
* Call <code>checkRead()</code>, then forward this method to the
* wrapped object.
*/
public Object getAttribute(ObjectName name, String attribute)
throws
MBeanException,
AttributeNotFoundException,
InstanceNotFoundException,
ReflectionException {
checkRead();
return getMBeanServer().getAttribute(name, attribute);
}
MBeanProxyFactory.java 文件源码
项目:monarch
阅读 21
收藏 0
点赞 0
评论 0
/**
* Removes all proxies for a given member
*
* @param member {@link org.apache.geode.distributed.DistributedMember}
* @param monitoringRegion monitoring region containing the proxies
*/
public void removeAllProxies(DistributedMember member, Region<String, Object> monitoringRegion) {
Set<Entry<String, Object>> entries = monitoringRegion.entrySet();
Iterator<Entry<String, Object>> entriesIt = entries.iterator();
if (logger.isDebugEnabled()) {
logger.debug("Removing {} proxies for member {}", entries.size(), member.getId());
}
while (entriesIt.hasNext()) {
String key = null;
Object val = null;
try {
Entry<String, Object> entry = entriesIt.next();
key = entry.getKey();// MBean Name in String format.
val = entry.getValue(); // Federation Component
ObjectName mbeanName = ObjectName.getInstance(key);
removeProxy(member, mbeanName, val);
} catch (Exception e) {
if (!(e.getCause() instanceof InstanceNotFoundException)) {
logger.warn("Remove Proxy failed for {} due to {}", key, e.getMessage(), e);
}
continue;
}
}
}
OldMBeanServerTest.java 文件源码
项目:openjdk-jdk10
阅读 30
收藏 0
点赞 0
评论 0
public ObjectInstance createMBean(
String className, ObjectName name, ObjectName loaderName,
Object[] params, String[] signature)
throws ReflectionException, InstanceAlreadyExistsException,
MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException {
Object mbean = instantiate(className, loaderName, params, signature);
return registerMBean(mbean, name);
}
StandardServerMBean.java 文件源码
项目:jerrydog
阅读 25
收藏 0
点赞 0
评论 0
/**
* Write the configuration information for this entire <code>Server</code>
* out to the server.xml configuration file.
*
* @exception InstanceNotFoundException if the managed resource object
* cannot be found
* @exception MBeanException if the initializer of the object throws
* an exception, or persistence is not supported
* @exception RuntimeOperationsException if an exception is reported
* by the persistence mechanism
*/
public synchronized void store() throws InstanceNotFoundException,
MBeanException, RuntimeOperationsException {
Server server = ServerFactory.getServer();
if (server instanceof StandardServer) {
try {
((StandardServer) server).store();
} catch (Exception e) {
throw new MBeanException(e, "Error updating conf/server.xml");
}
}
}
JmxNetworkManagerTest.java 文件源码
项目:Byter
阅读 28
收藏 0
点赞 0
评论 0
/**
* Test if there are all functions available.
*/
@Test
public void testStockAvailableOperations() throws IOException, IntrospectionException, InstanceNotFoundException, ReflectionException {
//connect to server
final JMXConnector connection = JmxConnectionHelper.buildJmxMPConnector(JMXSERVERIP,serverObj.getConnectorSystemPort());
//get MBeanServerConnection
MBeanServerConnection mbsConnection = JmxServerHelper.getMBeanServer(connection);
//check if mbeans are registered
Assert.assertNotSame(0,mbsConnection.getMBeanCount());
//do actual test
ObjectName networkManagerOn = JmxServerHelper.findObjectName(mbsConnection,"de.b4sh.byter","NetworkManager");
final List<MBeanOperationInfo> functions = JmxServerHelper.getOperations(mbsConnection,networkManagerOn);
Assert.assertNotEquals(0, functions.size());
}
RequiredModelMBean.java 文件源码
项目:jdk8u-jdk
阅读 27
收藏 0
点赞 0
评论 0
/**
* Sets the instance handle of the object against which to
* execute all methods in this ModelMBean management interface
* (MBeanInfo and Descriptors).
*
* @param mr Object that is the managed resource
* @param mr_type The type of reference for the managed resource.
* <br>Can be: "ObjectReference", "Handle", "IOR", "EJBHandle",
* or "RMIReference".
* <br>In this implementation only "ObjectReference" is supported.
*
* @exception MBeanException The initializer of the object has
* thrown an exception.
* @exception InstanceNotFoundException The managed resource
* object could not be found
* @exception InvalidTargetObjectTypeException The managed
* resource type should be "ObjectReference".
* @exception RuntimeOperationsException Wraps a {@link
* RuntimeException} when setting the resource.
**/
public void setManagedResource(Object mr, String mr_type)
throws MBeanException, RuntimeOperationsException,
InstanceNotFoundException, InvalidTargetObjectTypeException {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(),
"setManagedResource(Object,String)","Entry");
}
// check that the mr_type is supported by this JMXAgent
// only "objectReference" is supported
if ((mr_type == null) ||
(! mr_type.equalsIgnoreCase("objectReference"))) {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(),
"setManagedResource(Object,String)",
"Managed Resource Type is not supported: " + mr_type);
}
throw new InvalidTargetObjectTypeException(mr_type);
}
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(),
"setManagedResource(Object,String)",
"Managed Resource is valid");
}
managedResource = mr;
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(),
"setManagedResource(Object, String)", "Exit");
}
}