Class RMIConnectionImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,Remote,Unreferenced,RMIConnection
Implementation of the RMIConnection interface. User
code will not usually reference this class.
- Since:
- 1.5
-
Constructor Summary
ConstructorsConstructorDescriptionRMIConnectionImpl(RMIServerImpl rmiServer, String connectionId, ClassLoader defaultClassLoader, Subject subject, Map<String, ?> env) Constructs a newRMIConnection. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) Integer[]addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegationSubjects) voidclose()Closes this connection.createMBean(String className, ObjectName name, MarshalledObject params, String[] signature, Subject delegationSubject) Handles the methodMBeanServerConnection.createMBean(String, ObjectName, Object[], String[]).createMBean(String className, ObjectName name, ObjectName loaderName, MarshalledObject params, String[] signature, Subject delegationSubject) createMBean(String className, ObjectName name, ObjectName loaderName, Subject delegationSubject) Handles the methodMBeanServerConnection.createMBean(String, ObjectName, ObjectName).createMBean(String className, ObjectName name, Subject delegationSubject) Handles the methodMBeanServerConnection.createMBean(String, ObjectName).fetchNotifications(long clientSequenceNumber, int maxNotifications, long timeout) Retrieves notifications from the connector server.getAttribute(ObjectName name, String attribute, Subject delegationSubject) Handles the methodMBeanServerConnection.getAttribute(ObjectName, String).getAttributes(ObjectName name, String[] attributes, Subject delegationSubject) Handles the methodMBeanServerConnection.getAttributes(ObjectName, String[]).Returns the connection ID.getDefaultDomain(Subject delegationSubject) Handles the methodMBeanServerConnection.getDefaultDomain().String[]getDomains(Subject delegationSubject) Handles the methodMBeanServerConnection.getDomains().getMBeanCount(Subject delegationSubject) Handles the methodMBeanServerConnection.getMBeanCount().getMBeanInfo(ObjectName name, Subject delegationSubject) Handles the methodMBeanServerConnection.getMBeanInfo(ObjectName).getObjectInstance(ObjectName name, Subject delegationSubject) Handles the methodMBeanServerConnection.getObjectInstance(ObjectName).invoke(ObjectName name, String operationName, MarshalledObject params, String[] signature, Subject delegationSubject) Handles the methodMBeanServerConnection.invoke(ObjectName, String, Object[], String[]).booleanisInstanceOf(ObjectName name, String className, Subject delegationSubject) Handles the methodMBeanServerConnection.isInstanceOf(ObjectName, String).booleanisRegistered(ObjectName name, Subject delegationSubject) Handles the methodMBeanServerConnection.isRegistered(ObjectName).queryMBeans(ObjectName name, MarshalledObject query, Subject delegationSubject) Handles the methodMBeanServerConnection.queryMBeans(ObjectName, QueryExp).queryNames(ObjectName name, MarshalledObject query, Subject delegationSubject) Handles the methodMBeanServerConnection.queryNames(ObjectName, QueryExp).voidremoveNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) voidremoveNotificationListener(ObjectName name, ObjectName listener, Subject delegationSubject) Handles the methodMBeanServerConnection.removeNotificationListener(ObjectName, ObjectName).voidremoveNotificationListeners(ObjectName name, Integer[] listenerIDs, Subject delegationSubject) voidsetAttribute(ObjectName name, MarshalledObject attribute, Subject delegationSubject) Handles the methodMBeanServerConnection.setAttribute(ObjectName, Attribute).setAttributes(ObjectName name, MarshalledObject attributes, Subject delegationSubject) Handles the methodMBeanServerConnection.setAttributes(ObjectName, AttributeList).toString()Returns a string representation of this object.voidCalled by the RMI runtime sometime after the runtime determines that the reference list, the list of clients referencing the remote object, becomes empty.voidunregisterMBean(ObjectName name, Subject delegationSubject) Handles the methodMBeanServerConnection.unregisterMBean(ObjectName).
-
Constructor Details
-
RMIConnectionImpl
public RMIConnectionImpl(RMIServerImpl rmiServer, String connectionId, ClassLoader defaultClassLoader, Subject subject, Map<String, ?> env) Constructs a newRMIConnection. This connection can be used with the JRMP transport. This object does not export itself: it is the responsibility of the caller to export it appropriately (seeRMIJRMPServerImpl.makeClient(String,Subject)).- Parameters:
rmiServer- The RMIServerImpl object for which this connection is created. The behavior is unspecified if this parameter is null.connectionId- The ID for this connection. The behavior is unspecified if this parameter is null.defaultClassLoader- The default ClassLoader to be used when deserializing marshalled objects. Can be null, to signify the bootstrap class loader.subject- the authenticated subject to be used for authorization. Can be null, to signify that no subject has been authenticated.env- the environment containing attributes for the newRMIServerImpl. Can be null, equivalent to an empty map.
-
-
Method Details
-
getConnectionId
Description copied from interface:RMIConnectionReturns the connection ID. This string is different for every open connection to a given RMI connector server.
- Specified by:
getConnectionIdin interfaceRMIConnection- Returns:
- the connection ID
- Throws:
IOException- if a general communication exception occurred.- See Also:
-
close
Description copied from interface:RMIConnectionCloses this connection. On return from this method, the RMI object implementing this interface is unexported, so further remote calls to it will fail.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceRMIConnection- Throws:
IOException- if the connection could not be closed, or the Remote object could not be unexported, or there was a communication failure when transmitting the remote close request.
-
unreferenced
public void unreferenced()Description copied from interface:UnreferencedCalled by the RMI runtime sometime after the runtime determines that the reference list, the list of clients referencing the remote object, becomes empty.- Specified by:
unreferencedin interfaceUnreferenced
-
createMBean
public ObjectInstance createMBean(String className, ObjectName name, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.createMBean(String, ObjectName).- Specified by:
createMBeanin interfaceRMIConnection- Parameters:
className- The class name of the MBean to be instantiated.name- The object name of the MBean. May be null.delegationSubject- must benull.- Returns:
- An
ObjectInstance, containing theObjectNameand the Java class name of the newly instantiated MBean. If the containedObjectNameisn, the contained Java class name is.getMBeanInfo(n).getClassName() - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.ReflectionException- Wraps ajava.lang.ClassNotFoundExceptionor ajava.lang.Exceptionthat occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException- The MBean is already under the control of the MBean server.MBeanRegistrationException- ThepreRegister(MBeanRegistrationinterface) method of the MBean has thrown an exception. The MBean will not be registered.MBeanException- The constructor of the MBean has thrown an exception.NotCompliantMBeanException- This class is not a JMX compliant MBean.IOException- if a general communication exception occurred.
-
createMBean
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.createMBean(String, ObjectName, ObjectName).- Specified by:
createMBeanin interfaceRMIConnection- Parameters:
className- The class name of the MBean to be instantiated.name- The object name of the MBean. May be null.loaderName- The object name of the class loader to be used.delegationSubject- must benull.- Returns:
- An
ObjectInstance, containing theObjectNameand the Java class name of the newly instantiated MBean. If the containedObjectNameisn, the contained Java class name is.getMBeanInfo(n).getClassName() - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.ReflectionException- Wraps ajava.lang.ClassNotFoundExceptionor ajava.lang.Exceptionthat occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException- The MBean is already under the control of the MBean server.MBeanRegistrationException- ThepreRegister(MBeanRegistrationinterface) method of the MBean has thrown an exception. The MBean will not be registered.MBeanException- The constructor of the MBean has thrown an exception.NotCompliantMBeanException- This class is not a JMX compliant MBean.InstanceNotFoundException- The specified class loader is not registered in the MBean server.IOException- if a general communication exception occurred.
-
createMBean
public ObjectInstance createMBean(String className, ObjectName name, MarshalledObject params, String[] signature, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.createMBean(String, ObjectName, Object[], String[]). TheObject[]parameter is wrapped in aMarshalledObject.- Specified by:
createMBeanin interfaceRMIConnection- Parameters:
className- The class name of the MBean to be instantiated.name- The object name of the MBean. May be null.params- An array containing the parameters of the constructor to be invoked, encapsulated into aMarshalledObject. The encapsulated array can be null, equivalent to an empty array.signature- An array containing the signature of the constructor to be invoked. Can be null, equivalent to an empty array.delegationSubject- must benull.- Returns:
- An
ObjectInstance, containing theObjectNameand the Java class name of the newly instantiated MBean. If the containedObjectNameisn, the contained Java class name is.getMBeanInfo(n).getClassName() - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.ReflectionException- Wraps ajava.lang.ClassNotFoundExceptionor ajava.lang.Exceptionthat occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException- The MBean is already under the control of the MBean server.MBeanRegistrationException- ThepreRegister(MBeanRegistrationinterface) method of the MBean has thrown an exception. The MBean will not be registered.MBeanException- The constructor of the MBean has thrown an exception.NotCompliantMBeanException- This class is not a JMX compliant MBean.IOException- if a general communication exception occurred.
-
createMBean
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, MarshalledObject params, String[] signature, Subject delegationSubject) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.createMBean(String, ObjectName, ObjectName, Object[], String[]). TheObject[]parameter is wrapped in aMarshalledObject.- Specified by:
createMBeanin interfaceRMIConnection- Parameters:
className- The class name of the MBean to be instantiated.name- The object name of the MBean. May be null.loaderName- The object name of the class loader to be used.params- An array containing the parameters of the constructor to be invoked, encapsulated into aMarshalledObject. The encapsulated array can be null, equivalent to an empty array.signature- An array containing the signature of the constructor to be invoked. Can be null, equivalent to an empty array.delegationSubject- must benull.- Returns:
- An
ObjectInstance, containing theObjectNameand the Java class name of the newly instantiated MBean. If the containedObjectNameisn, the contained Java class name is.getMBeanInfo(n).getClassName() - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.ReflectionException- Wraps ajava.lang.ClassNotFoundExceptionor ajava.lang.Exceptionthat occurred when trying to invoke the MBean's constructor.InstanceAlreadyExistsException- The MBean is already under the control of the MBean server.MBeanRegistrationException- ThepreRegister(MBeanRegistrationinterface) method of the MBean has thrown an exception. The MBean will not be registered.MBeanException- The constructor of the MBean has thrown an exception.NotCompliantMBeanException- This class is not a JMX compliant MBean.InstanceNotFoundException- The specified class loader is not registered in the MBean server.IOException- if a general communication exception occurred.
-
unregisterMBean
public void unregisterMBean(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, MBeanRegistrationException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.unregisterMBean(ObjectName).- Specified by:
unregisterMBeanin interfaceRMIConnection- Parameters:
name- The object name of the MBean to be unregistered.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.MBeanRegistrationException- The preDeregister (MBeanRegistrationinterface) method of the MBean has thrown an exception.IOException- if a general communication exception occurred.
-
getObjectInstance
public ObjectInstance getObjectInstance(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getObjectInstance(ObjectName).- Specified by:
getObjectInstancein interfaceRMIConnection- Parameters:
name- The object name of the MBean.delegationSubject- must benull.- Returns:
- The
ObjectInstanceassociated with the MBean specified by name. The containedObjectNameisnameand the contained class name is.getMBeanInfo(name).getClassName() - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.IOException- if a general communication exception occurred.
-
queryMBeans
public Set<ObjectInstance> queryMBeans(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.queryMBeans(ObjectName, QueryExp). TheQueryExpis wrapped in aMarshalledObject.- Specified by:
queryMBeansin interfaceRMIConnection- Parameters:
name- The object name pattern identifying the MBeans to be retrieved. If null or no domain and key properties are specified, all the MBeans registered will be retrieved.query- The query expression to be applied for selecting MBeans, encapsulated into aMarshalledObject. If theMarshalledObjectencapsulates a null value no query expression will be applied for selecting MBeans.delegationSubject- must benull.- Returns:
- A set containing the
ObjectInstanceobjects for the selected MBeans. If no MBean satisfies the query an empty list is returned. - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
queryNames
public Set<ObjectName> queryNames(ObjectName name, MarshalledObject query, Subject delegationSubject) throws IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.queryNames(ObjectName, QueryExp). TheQueryExpis wrapped in aMarshalledObject.- Specified by:
queryNamesin interfaceRMIConnection- Parameters:
name- The object name pattern identifying the MBean names to be retrieved. If null or no domain and key properties are specified, the name of all registered MBeans will be retrieved.query- The query expression to be applied for selecting MBeans, encapsulated into aMarshalledObject. If theMarshalledObjectencapsulates a null value no query expression will be applied for selecting MBeans.delegationSubject- must benull.- Returns:
- A set containing the ObjectNames for the MBeans selected. If no MBean satisfies the query, an empty list is returned.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
isRegistered
Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.isRegistered(ObjectName).- Specified by:
isRegisteredin interfaceRMIConnection- Parameters:
name- The object name of the MBean to be checked.delegationSubject- must benull.- Returns:
- True if the MBean is already registered in the MBean server, false otherwise.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
getMBeanCount
Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getMBeanCount().- Specified by:
getMBeanCountin interfaceRMIConnection- Parameters:
delegationSubject- must benull.- Returns:
- the number of MBeans registered.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
getAttribute
public Object getAttribute(ObjectName name, String attribute, Subject delegationSubject) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getAttribute(ObjectName, String).- Specified by:
getAttributein interfaceRMIConnection- Parameters:
name- The object name of the MBean from which the attribute is to be retrieved.attribute- A String specifying the name of the attribute to be retrieved.delegationSubject- must benull.- Returns:
- The value of the retrieved attribute.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.MBeanException- Wraps an exception thrown by the MBean's getter.AttributeNotFoundException- The attribute specified is not accessible in the MBean.InstanceNotFoundException- The MBean specified is not registered in the MBean server.ReflectionException- Wraps ajava.lang.Exceptionthrown when trying to invoke the getter.IOException- if a general communication exception occurred.- See Also:
-
getAttributes
public AttributeList getAttributes(ObjectName name, String[] attributes, Subject delegationSubject) throws InstanceNotFoundException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getAttributes(ObjectName, String[]).- Specified by:
getAttributesin interfaceRMIConnection- Parameters:
name- The object name of the MBean from which the attributes are retrieved.attributes- A list of the attributes to be retrieved.delegationSubject- must benull.- Returns:
- The list of the retrieved attributes.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.ReflectionException- An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.IOException- if a general communication exception occurred.- See Also:
-
setAttribute
public void setAttribute(ObjectName name, MarshalledObject attribute, Subject delegationSubject) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.setAttribute(ObjectName, Attribute). TheAttributeparameter is wrapped in aMarshalledObject.- Specified by:
setAttributein interfaceRMIConnection- Parameters:
name- The name of the MBean within which the attribute is to be set.attribute- The identification of the attribute to be set and the value it is to be set to, encapsulated into aMarshalledObject.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.AttributeNotFoundException- The attribute specified is not accessible in the MBean.InvalidAttributeValueException- The value specified for the attribute is not valid.MBeanException- Wraps an exception thrown by the MBean's setter.ReflectionException- Wraps ajava.lang.Exceptionthrown when trying to invoke the setter.IOException- if a general communication exception occurred.- See Also:
-
setAttributes
public AttributeList setAttributes(ObjectName name, MarshalledObject attributes, Subject delegationSubject) throws InstanceNotFoundException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.setAttributes(ObjectName, AttributeList). TheAttributeListparameter is wrapped in aMarshalledObject.- Specified by:
setAttributesin interfaceRMIConnection- Parameters:
name- The object name of the MBean within which the attributes are to be set.attributes- A list of attributes: The identification of the attributes to be set and the values they are to be set to, encapsulated into aMarshalledObject.delegationSubject- must benull.- Returns:
- The list of attributes that were set, with their new values.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.ReflectionException- An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.IOException- if a general communication exception occurred.- See Also:
-
invoke
public Object invoke(ObjectName name, String operationName, MarshalledObject params, String[] signature, Subject delegationSubject) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.invoke(ObjectName, String, Object[], String[]). TheObject[]parameter is wrapped in aMarshalledObject.- Specified by:
invokein interfaceRMIConnection- Parameters:
name- The object name of the MBean on which the method is to be invoked.operationName- The name of the operation to be invoked.params- An array containing the parameters to be set when the operation is invoked, encapsulated into aMarshalledObject. The encapsulated array can be null, equivalent to an empty array.signature- An array containing the signature of the operation. The class objects will be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked. Can be null, equivalent to an empty array.delegationSubject- must benull.- Returns:
- The object returned by the operation, which represents the result of invoking the operation on the MBean specified.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.MBeanException- Wraps an exception thrown by the MBean's invoked method.ReflectionException- Wraps ajava.lang.Exceptionthrown while trying to invoke the method.IOException- if a general communication exception occurred.
-
getDefaultDomain
Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getDefaultDomain().- Specified by:
getDefaultDomainin interfaceRMIConnection- Parameters:
delegationSubject- must benull.- Returns:
- the default domain.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
getDomains
Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getDomains().- Specified by:
getDomainsin interfaceRMIConnection- Parameters:
delegationSubject- must benull.- Returns:
- the list of domains.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.IOException- if a general communication exception occurred.
-
getMBeanInfo
public MBeanInfo getMBeanInfo(ObjectName name, Subject delegationSubject) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.getMBeanInfo(ObjectName).- Specified by:
getMBeanInfoin interfaceRMIConnection- Parameters:
name- The name of the MBean to analyzedelegationSubject- must benull.- Returns:
- An instance of
MBeanInfoallowing the retrieval of all attributes and operations of this MBean. - Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified was not found.IntrospectionException- An exception occurred during introspection.ReflectionException- An exception occurred when trying to invoke the getMBeanInfo of a Dynamic MBean.IOException- if a general communication exception occurred.
-
isInstanceOf
public boolean isInstanceOf(ObjectName name, String className, Subject delegationSubject) throws InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.isInstanceOf(ObjectName, String).- Specified by:
isInstanceOfin interfaceRMIConnection- Parameters:
name- TheObjectNameof the MBean.className- The name of the class.delegationSubject- must benull.- Returns:
- true if the MBean specified is an instance of the specified class according to the rules above, false otherwise.
- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean specified is not registered in the MBean server.IOException- if a general communication exception occurred.
-
addNotificationListeners
public Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegationSubjects) throws InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the method
MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object).Register for notifications from the given MBeans that match the given filters. The remote client can subsequently retrieve the notifications using the
fetchNotificationsmethod.For each listener, the original
NotificationListenerandhandbackare kept on the client side; in order for the client to be able to identify them, the server generates and returns a uniquelistenerID. ThislistenerIDis forwarded with theNotificationsto the remote client.If any one of the given (name, filter) pairs cannot be registered, then the operation fails with an exception, and no names or filters are registered.
- Specified by:
addNotificationListenersin interfaceRMIConnection- Parameters:
names- theObjectNamesidentifying the MBeans emitting the Notifications.filters- an array of marshalled representations of theNotificationFilters. Elements of this array can be null.delegationSubjects- must benull, or an array which does not contain any non-null entries.- Returns:
- an array of
listenerIDsidentifying the local listeners. This array has the same number of elements as the parameters. - Throws:
UnsupportedOperationException- ifdelegationSubjectsis non-null and contains any non-null entries.InstanceNotFoundException- if one of thenamesdoes not correspond to any registered MBean.IOException- if a general communication exception occurred.
-
addNotificationListener
public void addNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) throws InstanceNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.addNotificationListener(ObjectName, ObjectName, NotificationFilter, Object). TheNotificationFilterparameter is wrapped in aMarshalledObject. TheObject(handback) parameter is also wrapped in aMarshalledObject.- Specified by:
addNotificationListenerin interfaceRMIConnection- Parameters:
name- The name of the MBean on which the listener should be added.listener- The object name of the listener which will handle the notifications emitted by the registered MBean.filter- The filter object, encapsulated into aMarshalledObject. If filter encapsulated in theMarshalledObjecthas a null value, no filtering will be performed before handling notifications.handback- The context to be sent to the listener when a notification is emitted, encapsulated into aMarshalledObject.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean name of the notification listener or of the notification broadcaster does not match any of the registered MBeans.IOException- if a general communication exception occurred.- See Also:
-
removeNotificationListeners
public void removeNotificationListeners(ObjectName name, Integer[] listenerIDs, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException Description copied from interface:RMIConnectionHandles the
removeNotificationListener(ObjectName, NotificationListener)andremoveNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)methods.This method removes one or more
NotificationListeners from a given MBean in the MBean server.The
NotificationListenersare identified by the IDs which were returned by theRMIConnection.addNotificationListeners(ObjectName[], MarshalledObject[], Subject[])method.- Specified by:
removeNotificationListenersin interfaceRMIConnection- Parameters:
name- theObjectNameidentifying the MBean emitting the Notifications.listenerIDs- the list of the IDs corresponding to the listeners to remove.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- if the givennamedoes not correspond to any registered MBean.ListenerNotFoundException- if one of the listeners was not found on the server side. This exception can happen if the MBean discarded a listener for some reason other than a call toMBeanServer.removeNotificationListener.IOException- if a general communication exception occurred.
-
removeNotificationListener
public void removeNotificationListener(ObjectName name, ObjectName listener, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.removeNotificationListener(ObjectName, ObjectName).- Specified by:
removeNotificationListenerin interfaceRMIConnection- Parameters:
name- The name of the MBean on which the listener should be removed.listener- The object name of the listener to be removed.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean name provided does not match any of the registered MBeans.ListenerNotFoundException- The listener is not registered in the MBean.IOException- if a general communication exception occurred.- See Also:
-
removeNotificationListener
public void removeNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, MarshalledObject handback, Subject delegationSubject) throws InstanceNotFoundException, ListenerNotFoundException, IOException Description copied from interface:RMIConnectionHandles the methodMBeanServerConnection.removeNotificationListener(ObjectName, ObjectName, NotificationFilter, Object). TheNotificationFilterparameter is wrapped in aMarshalledObject. TheObjectparameter is also wrapped in aMarshalledObject.- Specified by:
removeNotificationListenerin interfaceRMIConnection- Parameters:
name- The name of the MBean on which the listener should be removed.listener- A listener that was previously added to this MBean.filter- The filter that was specified when the listener was added, encapsulated into aMarshalledObject.handback- The handback that was specified when the listener was added, encapsulated into aMarshalledObject.delegationSubject- must benull.- Throws:
UnsupportedOperationException- ifdelegationSubjectis non-null.InstanceNotFoundException- The MBean name provided does not match any of the registered MBeans.ListenerNotFoundException- The listener is not registered in the MBean, or it is not registered with the given filter and handback.IOException- if a general communication exception occurred.- See Also:
-
fetchNotifications
public NotificationResult fetchNotifications(long clientSequenceNumber, int maxNotifications, long timeout) throws IOException Description copied from interface:RMIConnectionRetrieves notifications from the connector server. This method can block until there is at least one notification or until the specified timeout is reached. The method can also return at any time with zero notifications.
A notification can be included in the result if its sequence number is no less than
clientSequenceNumberand this client has registered at least one listener for the MBean generating the notification, with a filter that accepts the notification. Each listener that is interested in the notification is identified by an Integer ID that was returned byRMIConnection.addNotificationListeners(ObjectName[], MarshalledObject[], Subject[]).- Specified by:
fetchNotificationsin interfaceRMIConnection- Parameters:
clientSequenceNumber- the first sequence number that the client is interested in. If negative, it is interpreted as meaning the sequence number that the next notification will have.maxNotifications- the maximum number of different notifications to return. TheTargetedNotificationarray in the returnedNotificationResultcan have more elements than this if the same notification appears more than once. The behavior is unspecified if this parameter is negative.timeout- the maximum time in milliseconds to wait for a notification to arrive. This can be 0 to indicate that the method should not wait if there are no notifications, but should return at once. It can beLong.MAX_VALUEto indicate that there is no timeout. The behavior is unspecified if this parameter is negative.- Returns:
- A
NotificationResult. - Throws:
IOException- if a general communication exception occurred.
-
toString
Returns a string representation of this object. In general, the
toStringmethod returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.
-