-
- All Superinterfaces:
-
AutoCloseable,Closeable,Remote
- 所有已知实现类:
-
RMIConnectionImpl,RMIConnectionImpl_Stub
public interface RMIConnection extends Closeable, Remote
用于将MBeanServer请求从客户端转发到其在服务器端的MBeanServer实现的RMI对象。 为连接到RMI连接器的每个远程客户端都有一个Remote对象实现此接口。
用户代码通常不涉及此界面。 它被指定为公共API的一部分,以便该API的不同实现将互操作。
为了确保客户端参数在服务器端使用正确的类加载器进行反序列化,客户端参数(如用于调用方法的参数)将包装在一个
MarshalledObject中 。 此接口的实现必须首先为操作及其目标获取适当的类加载器,然后使用此类加载器对编组的参数进行反序列化。 除非另有说明,否则为MarshalledObject或MarshalledObject[]的参数不能为空; 如果是,行为是未指定的。JMX Specification, version 1.4 PDF文档中详细介绍了类加载方面。
大多数方法在这个接口中并行方法在
MBeanServerConnection接口中。 在这里没有指定方法的行为方面,它与相应的MBeanServerConnection方法相同。- 从以下版本开始:
- 1.5
-
-
方法摘要
-
-
-
方法详细信息
-
getConnectionId
String getConnectionId() throws IOException
返回连接ID。 每个与给定RMI连接器服务器的打开连接的字符串不同。
- 结果
- 连接ID
- 异常
-
IOException- 如果发生通用通信异常。 - 另请参见:
-
RMIConnector.connect
-
close
void close() throws IOException关闭此连接。 从此方法返回时,实现此接口的RMI对象将被取消导出,因此对其的远程调用将失败。
- Specified by:
-
close在接口AutoCloseable - Specified by:
-
close在接口Closeable - 异常
-
IOException- 如果无法关闭连接,或远程对象无法取消导出,或者发送远程关闭请求时发生通信故障。
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
- 参数
-
className- 要实例化的MBean的类名。 -
name- MBean的对象名称。 可能为null。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一个
ObjectInstance,包含ObjectName和新实例化的MBean的Java类名。 如果包含的ObjectName是n,则包含的Java类名称为。getMBeanInfo(n).getClassName() - 异常
-
ReflectionException- 包装一个java.lang.ClassNotFoundException或java.lang.Exception,当尝试调用MBean的构造函数时。 -
InstanceAlreadyExistsException- MBean已经在MBean服务器的控制之下了。 -
MBeanRegistrationException- MBean的preRegister(MBeanRegistration接口)方法已经抛出异常。 MBean将不会被注册。 -
MBeanException- MBean的构造函数已经抛出异常。 -
NotCompliantMBeanException- 此类不是符合JMX的MBean。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:传入参数的className为null,传入参数的ObjectName包含一个模式,或者为MBean指定了ObjectName。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
- 参数
-
className- 要实例化的MBean的类名。 -
name- MBean的对象名称。 可能为null。 -
loaderName- 要使用的类加载器的对象名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一个
ObjectInstance,包含ObjectName和新实例化的MBean的Java类名。 如果包含的ObjectName是n,则包含的Java类名称为。getMBeanInfo(n).getClassName() - 异常
-
ReflectionException- 包装一个java.lang.ClassNotFoundException或java.lang.Exception,当尝试调用MBean的构造函数时发生。 -
InstanceAlreadyExistsException- MBean已经在MBean服务器的控制之下了。 -
MBeanRegistrationException- MBean的preRegister(MBeanRegistration接口)方法抛出异常。 MBean将不会被注册。 -
MBeanException- MBean的构造函数抛出异常。 -
NotCompliantMBeanException- 此类不是符合JMX的MBean。 -
InstanceNotFoundException- 指定的类加载器未在MBean服务器中注册。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:传入参数的className为null,传入参数的ObjectName包含一个模式,或者没有为MBean指定ObjectName。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, MarshalledObject params, String[] signature, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException
处理方法MBeanServerConnection.createMBean(String, ObjectName, Object[], String[])。Object[]参数包裹在一个MarshalledObject。- 参数
-
className- 要实例化的MBean的类名。 -
name- MBean的对象名称。 可能为null。 -
params- 包含要调用的构造函数的参数的数组,封装在一个MarshalledObject。 封装的数组可以为空,相当于一个空数组。 -
signature- 包含要调用的构造函数的签名的数组。 可以为null,相当于一个空数组。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一个
ObjectInstance,包含ObjectName和新实例化的MBean的Java类名。 如果包含的ObjectName是n,则包含的Java类名称为。getMBeanInfo(n).getClassName() - 异常
-
ReflectionException- 包装一个java.lang.ClassNotFoundException或java.lang.Exception在尝试调用MBean的构造函数时发生。 -
InstanceAlreadyExistsException- MBean已经在MBean服务器的控制之下了。 -
MBeanRegistrationException- MBean的preRegister(MBeanRegistration接口)方法抛出异常。 MBean将不会被注册。 -
MBeanException- MBean的构造函数已经抛出异常。 -
NotCompliantMBeanException- 此类不是符合JMX的MBean。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:传入参数的className为null,传入参数中的ObjectName包含一个模式,或者为MBean指定了ObjectName。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
createMBean
ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, MarshalledObject params, String[] signature, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException
处理方法MBeanServerConnection.createMBean(String, ObjectName, ObjectName, Object[], String[])。Object[]参数包裹在一个MarshalledObject。- 参数
-
className- 要实例化的MBean的类名。 -
name- MBean的对象名称。 可能为null。 -
loaderName- 要使用的类加载器的对象名称。 -
params- 包含要调用的构造函数的参数的数组,封装在一个MarshalledObject。 封装的数组可以为空,相当于一个空数组。 -
signature- 包含要调用的构造函数的签名的数组。 可以为null,相当于一个空数组。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一个
ObjectInstance,包含ObjectName和新实例化的MBean的Java类名。 如果包含的ObjectName是n,则包含的Java类名称为。getMBeanInfo(n).getClassName() - 异常
-
ReflectionException- 包装一个java.lang.ClassNotFoundException或java.lang.Exception,当尝试调用MBean的构造函数时。 -
InstanceAlreadyExistsException- MBean已经在MBean服务器的控制之下了。 -
MBeanRegistrationException- MBean的preRegister(MBeanRegistration接口)方法已经抛出异常。 MBean将不会被注册。 -
MBeanException- MBean的构造函数已经抛出异常。 -
NotCompliantMBeanException- 此类不是符合JMX的MBean。 -
InstanceNotFoundException- 指定的类加载器未在MBean服务器中注册。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:传入参数中的className为null,传入参数的ObjectName包含一个模式,或者为MBean指定了ObjectName。 -
SecurityException- 如果客户端或委托主题(如果有)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
unregisterMBean
void unregisterMBean(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, MBeanRegistrationException, IOException
- 参数
-
name- 要注销的MBean的对象名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
MBeanRegistrationException- MBean的preDeregister((MBeanRegistration接口)方法已经抛出异常。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null或尝试注销时的MBean是MBeanServerDelegateMBean。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
getObjectInstance
ObjectInstance getObjectInstance(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, IOException
- 参数
-
name- MBean的对象名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
与名称指定的MBean相关联的
ObjectInstance。 包含的ObjectName是name,包含的类名是。getMBeanInfo(name).getClassName() - 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
queryMBeans
Set<ObjectInstance> queryMBeans(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException
处理方法MBeanServerConnection.queryMBeans(ObjectName, QueryExp)。QueryExp包裹在一个MarshalledObject。- 参数
-
name- 标识要检索的MBean的对象名称模式。 如果指定了null或没有域和密钥属性,则将检索注册的所有MBean。 -
query- 要应用于选择MBean的查询表达式,封装在MarshalledObject。 如果MarshalledObject封装了空值,则不会使用查询表达式来选择MBean。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一组包含所选MBean的
ObjectInstance对象。 如果没有MBean满足查询,则返回一个空列表。 - 异常
-
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
queryNames
Set<ObjectName> queryNames(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException
处理方法MBeanServerConnection.queryNames(ObjectName, QueryExp)。QueryExp包裹在一个MarshalledObject。- 参数
-
name- 标识要检索的MBean名称的对象名称模式。 如果指定了null或没有域和键属性,将检索所有注册的MBean的名称。 -
query- 要应用于选择MBean的查询表达式,封装在MarshalledObject。 如果MarshalledObject封装了空值,则不会使用查询表达式来选择MBean。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 包含所选MBean的ObjectName的集合。 如果没有MBean满足查询,则返回一个空列表。
- 异常
-
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
isRegistered
boolean isRegistered(ObjectName name, Subject delegationSubject) throws IOException
- 参数
-
name- 要检查的MBean的对象名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 如果MBean已经在MBean服务器中注册,则为true,否则为false。
- 异常
-
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
getMBeanCount
Integer getMBeanCount(Subject delegationSubject) throws IOException
- 参数
-
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 注册的MBean的数量。
- 异常
-
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
getAttribute
Object getAttribute(ObjectName name, String attribute, Subject delegationSubject) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException
- 参数
-
name- 要从中检索属性的MBean的对象名称。 -
attribute- 指定要检索的属性的名称的字符串。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 检索属性的值。
- 异常
-
AttributeNotFoundException- 指定的属性在MBean中无法访问。 -
MBeanException- 包装MBean的getter抛出的异常。 -
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
ReflectionException- 在尝试调用吸气剂时抛出一个java.lang.Exception。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null或参数中的属性为null。 -
RuntimeMBeanException- 包装由MBean的getter抛出的运行时异常。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。 - 另请参见:
-
setAttribute(javax.management.ObjectName, java.rmi.MarshalledObject, javax.security.auth.Subject)
-
getAttributes
AttributeList getAttributes(ObjectName name, String[] attributes, Subject delegationSubject) throws InstanceNotFoundException, ReflectionException, IOException
- 参数
-
name- 从中检索属性的MBean的对象名称。 -
attributes- 要检索的属性的列表。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 检索属性的列表。
- 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
ReflectionException- 尝试调用动态MBean的getAttributes方法时发生异常。 -
RuntimeOperationsException- 包装java.lang.IllegalArgumentException:参数中的对象名称为null或参数中的属性为空。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。 - 另请参见:
-
setAttributes(javax.management.ObjectName, java.rmi.MarshalledObject, javax.security.auth.Subject)
-
setAttribute
void setAttribute(ObjectName name, MarshalledObject attribute, Subject delegationSubject) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException
处理方法MBeanServerConnection.setAttribute(ObjectName, Attribute)。Attribute参数包裹在一个MarshalledObject。- 参数
-
name- 要在其中设置属性的MBean的名称。 -
attribute- 要设置的属性的标识和要设置的值,封装在MarshalledObject。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
AttributeNotFoundException- 指定的属性在MBean中无法访问。 -
InvalidAttributeValueException- 为属性指定的值无效。 -
MBeanException- 包装MBean的setter抛出的异常。 -
ReflectionException- 在尝试调用设置器时抛出一个java.lang.Exception。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null或参数中的属性为null。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。 - 另请参见:
-
getAttribute(javax.management.ObjectName, java.lang.String, javax.security.auth.Subject)
-
setAttributes
AttributeList setAttributes(ObjectName name, MarshalledObject attributes, Subject delegationSubject) throws InstanceNotFoundException, ReflectionException, IOException
处理方法MBeanServerConnection.setAttributes(ObjectName, AttributeList)。AttributeList参数包裹在一个MarshalledObject。- 参数
-
name- 要在其中设置属性的MBean的对象名称。 -
attributes- 属性列表:要设置的属性的标识以及要设置的属性,封装在MarshalledObject。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 已设置的属性列表及其新值。
- 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
ReflectionException- 尝试调用动态MBean的getAttributes方法时发生异常。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null或参数中的属性为空。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。 - 另请参见:
-
getAttributes(javax.management.ObjectName, java.lang.String[], javax.security.auth.Subject)
-
invoke
Object invoke(ObjectName name, String operationName, MarshalledObject params, String[] signature, Subject delegationSubject) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException
处理方法MBeanServerConnection.invoke(ObjectName, String, Object[], String[])。Object[]参数包裹在一个MarshalledObject。- 参数
-
name- 要调用该方法的MBean的对象名称。 -
operationName- 要调用的操作的名称。 -
params- 一个包含调用操作时要设置的参数的数组,封装在一个MarshalledObject。 封装的数组可以为空,相当于一个空数组。 -
signature- 包含操作签名的数组。 将使用与用于加载调用操作的MBean相同的类加载器来加载类对象。 可以为null,相当于一个空数组。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 由操作返回的对象,表示在指定的MBean上调用操作的结果。
- 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
MBeanException- 包装MBean调用方法抛出的异常。 -
ReflectionException- 在尝试调用该方法时抛出一个java.lang.Exception。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。 -
RuntimeOperationsException-包装一个IllegalArgumentException时name或者operationName为空。
-
getDefaultDomain
String getDefaultDomain(Subject delegationSubject) throws IOException
- 参数
-
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 默认域。
- 异常
-
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。
-
getDomains
String[] getDomains(Subject delegationSubject) throws IOException
- 参数
-
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 域列表。
- 异常
-
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。
-
getMBeanInfo
MBeanInfo getMBeanInfo(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException
- 参数
-
name- 要分析的MBean的名称 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
-
一个
MBeanInfo的实例允许检索此MBean的所有属性和操作。 - 异常
-
IntrospectionException- 内省时发生异常。 -
InstanceNotFoundException- 未找到指定的MBean。 -
ReflectionException- 尝试调用动态MBean的getMBeanInfo时发生异常。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为空。
-
isInstanceOf
boolean isInstanceOf(ObjectName name, String className, Subject delegationSubject) throws InstanceNotFoundException, IOException
- 参数
-
name- MBean的ObjectName。 -
className- 类的名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 结果
- 如果指定的MBean是根据上述规则的指定类的实例,则为true,否则为false。
- 异常
-
InstanceNotFoundException- 指定的MBean未在MBean服务器中注册。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。 -
RuntimeOperationsException- 包裹一个java.lang.IllegalArgumentException:参数中的对象名称为null。
-
addNotificationListener
void addNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) throws InstanceNotFoundException, IOException
处理方法MBeanServerConnection.addNotificationListener(ObjectName, ObjectName, NotificationFilter, Object)。NotificationFilter参数包裹在一个MarshalledObject。Object(handback)参数也包裹在一个MarshalledObject。- 参数
-
name- 应该添加侦听器的MBean的名称。 -
listener- 将处理由注册的MBean发出的通知的侦听器的对象名称。 -
filter- 过滤器对象,封装在一个MarshalledObject。 如果MarshalledObject封装的过滤MarshalledObject值,则在处理通知之前不会执行过滤。 -
handback- 发送通知时发送到侦听器的上下文,封装在MarshalledObject。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 通知侦听器或通知广播者的MBean名称与任何已注册的MBean不匹配。 -
RuntimeOperationsException- 包裹一个IllegalArgumentException。 由listener命名的MBean存在但不实现NotificationListener接口,或name或listener为null。 -
SecurityException- 如果客户端或委托的主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。 - 另请参见:
-
removeNotificationListener(ObjectName, ObjectName, Subject),removeNotificationListener(ObjectName, ObjectName, MarshalledObject, MarshalledObject, Subject)
-
removeNotificationListener
void removeNotificationListener(ObjectName name, ObjectName listener, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException
- 参数
-
name- 应删除侦听器的MBean的名称。 -
listener- 要删除的侦听器的对象名称。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 提供的MBean名称与任何已注册的MBean不匹配。 -
ListenerNotFoundException- 监听器未在MBean中注册。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生通用通信异常。 -
RuntimeOperationsException-包装一个IllegalArgumentException时name或者listener为空。 - 另请参见:
-
addNotificationListener(javax.management.ObjectName, javax.management.ObjectName, java.rmi.MarshalledObject, java.rmi.MarshalledObject, javax.security.auth.Subject)
-
removeNotificationListener
void removeNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException
处理方法MBeanServerConnection.removeNotificationListener(ObjectName, ObjectName, NotificationFilter, Object)。NotificationFilter参数包裹在一个MarshalledObject。Object参数也包裹在一个MarshalledObject。- 参数
-
name- 应删除侦听器的MBean的名称。 -
listener- 以前添加到此MBean的侦听器。 -
filter- 添加侦听器时指定的过滤器,封装在MarshalledObject。 -
handback- 添加侦听器时指定的MarshalledObject,封装在MarshalledObject。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 提供的MBean名称与任何已注册的MBean不匹配。 -
ListenerNotFoundException- 监听器未在MBean中注册,或者未注册给定过滤器和回传。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有执行此操作的权限。 -
IOException- 如果发生一般通信异常。 -
RuntimeOperationsException-包装一个IllegalArgumentException时name或者listener为空。 - 另请参见:
-
addNotificationListener(javax.management.ObjectName, javax.management.ObjectName, java.rmi.MarshalledObject, java.rmi.MarshalledObject, javax.security.auth.Subject)
-
addNotificationListeners
Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegationSubjects) throws InstanceNotFoundException, IOException
注册与给定过滤器匹配的给定MBean的通知。 远程客户端随后可以使用
fetchNotifications方法检索通知。对于每个听众,原始的
NotificationListener和handback保存在客户端; 为了使客户端能够识别它们,服务器生成并返回唯一的listenerID。 该listenerID与Notifications一起转发给远程客户端。如果给定(名称,过滤器)对中的任何一个无法注册,则操作将失败并发生异常,并且不会注册名称或过滤器。
- 参数
-
names- 标识发布通知的MBean的ObjectNames。 -
filters-所述的编组表示的阵列NotificationFilters。 此数组的元素可以为空。 -
delegationSubjects- 代表正在添加的收听者的Subjects。 此数组的元素可以为空。 此外,delegationSubjects参数本身可以为空,这相当于与names和filters数组大小相同的空值数组。 - 结果
-
一个
listenerIDs的数组,listenerIDs标识本地侦听器。 该数组与参数的元素数量相同。 - 异常
-
IllegalArgumentException- 如果names或filters为空,或者如果names包含空元素,或者三个数组的大小都不相同。 -
ClassCastException-如果所述元件中的一个filters作为一个非空的对象,该对象是不是一个解组NotificationFilter。 -
InstanceNotFoundException- 如果names中的一个与任何注册的MBean不对应。 -
SecurityException- 如果对于其中一个MBean,客户端或委托的Subject(如果有的话)没有权限添加侦听器。 -
IOException- 如果发生通用通信异常。
-
removeNotificationListeners
void removeNotificationListeners(ObjectName name, Integer[] listenerIDs, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException
处理
removeNotificationListener(ObjectName, NotificationListener)和removeNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)方法。此方法从MBean服务器中的给定MBean中删除一个或多个
NotificationListener。NotificationListeners由addNotificationListeners(ObjectName[], MarshalledObject[], Subject[])方法返回的ID标识。- 参数
-
name-ObjectName标识发布通知的MBean。 -
listenerIDs- 与要删除的侦听器相对应的ID的列表。 -
delegationSubject-该Subject包含委托principal或null如果认证主要来代替。 - 异常
-
InstanceNotFoundException- 如果给定的name与任何注册的MBean不对应。 -
ListenerNotFoundException- 如果在服务器端没有找到其中一个侦听器。 如果MBean由于某种原因(而不是调用MBeanServer.removeNotificationListener丢弃一个监听器,则可能会发生此异常。 -
SecurityException- 如果客户端或委托主题(如果有的话)没有删除侦听器的权限。 -
IOException- 如果发生通用通信异常。 -
IllegalArgumentException- 如果ObjectName或listenerIds为空,或者如果listenerIds包含空元素。
-
fetchNotifications
NotificationResult fetchNotifications(long clientSequenceNumber, int maxNotifications, long timeout) throws IOException
从连接器服务器检索通知。 此方法可以阻止,直到有至少一个通知或直到达到指定的超时。 该方法也可以随时返回零通知。
如果序列号不小于
clientSequenceNumber,则该通知可以包含在结果中,并且该客户端已经为生成通知的MBean注册了至少一个监听器,并具有接受该通知的过滤器。 对通知感兴趣的每个监听器都由addNotificationListeners(ObjectName[], MarshalledObject[], Subject[])返回的整数ID标识。- 参数
-
clientSequenceNumber- 客户端感兴趣的第一个序列号。如果为负,则将其解释为下一个通知将具有的序列号。 -
maxNotifications- 返回的不同通知的最大数量。 返回的NotificationResult的TargetedNotification阵列可以具有比此更多的元素,如果相同的通知多次显示。 如果此参数为负,则该行为是未指定的。 -
timeout- 等待通知到达的最长时间(毫秒)。 这可以是0表示方法不应该等待,如果没有通知,但应该立即返回。 它可以是Long.MAX_VALUE来表示没有超时。 如果此参数为负,则该行为是未指定的。 - 结果
-
A
NotificationResult。 - 异常
-
IOException- 如果发生通用通信异常。
-
-