|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.jdmk.remote.cascading.BasicMBeanServerConnectionFactory
public class BasicMBeanServerConnectionFactory
A basic MBeanServerConnectionFactory
that wraps a
JMXConnector
.
This implementation does not support transparent reconnection.
Constructor Summary | |
---|---|
BasicMBeanServerConnectionFactory(JMXConnector connector,
Subject delegationSubject)
Creates a new BasicMBeanServerConnectionFactory for the given connector with the given
delegationSubject . |
Method Summary | |
---|---|
void |
addConnectionNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Adds a listener to be informed of changes in connection status. |
String |
getConnectionId()
Gets the current connection's ID from the connector server. |
Subject |
getDelegationSubject()
The delegation subject used by the underlying MBeanServerConnection. |
JMXConnector |
getJMXConnector()
Returns the underlying JMXConnector used by this
object. |
MBeanServerConnection |
getMBeanServerConnection()
Returns an MBeanServerConnection object
representing a remote MBean server. |
static MBeanServerConnectionFactory |
newInstance(JMXConnector c)
Creates a new instance of the BasicMBeanServerConnectionFactory. |
static MBeanServerConnectionFactory |
newInstance(JMXConnector c,
Subject subject)
Creates a new instance of the BasicMBeanServerConnectionFactory. |
static MBeanServerConnectionFactory |
newInstance(JMXServiceURL url)
Creates a new instance of the BasicMBeanServerConnectionFactory. |
static MBeanServerConnectionFactory |
newInstance(JMXServiceURL url,
Map map)
Creates a new instance of the BasicMBeanServerConnectionFactory. |
static MBeanServerConnectionFactory |
newInstance(JMXServiceURL url,
Map map,
Subject subject)
Creates a new instance of the BasicMBeanServerConnectionFactory. |
void |
removeConnectionNotificationListener(NotificationListener listener)
Removes a listener from the list to be informed of changes in status. |
void |
removeConnectionNotificationListener(NotificationListener l,
NotificationFilter f,
Object handback)
Removes a listener from the list to be informed of changes in status. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicMBeanServerConnectionFactory(JMXConnector connector, Subject delegationSubject)
connector
with the given
delegationSubject
.
The given connector must be connected before the factory can be used.
connector
- A JMConnector from which to obtain the
MBeanServerConnection.delegationSubject
- A delegation subject used to obtain
the underlying MBeanServerConnection
.JMXConnector.getMBeanServerConnection(Subject)
Method Detail |
---|
public JMXConnector getJMXConnector()
JMXConnector
used by this
object. This is the connector that was passed to this object's
constructor.
public final Subject getDelegationSubject()
Subject
that was passed to this object's
constructor.
JMXConnector.getMBeanServerConnection(Subject)
public MBeanServerConnection getMBeanServerConnection() throws IOException
Returns an MBeanServerConnection
object
representing a remote MBean server.
This implementation always return the same
MBeanServerConnection object.
The first time getMBeanServerConnection()
is called,
this method will obtain a new
MBeanServerConnection
by calling
getJMXConnector().getMBeanServerConnection(getDelegationSubject());
MBeanServerConnection
will then be returned by
subsequent calls. This behaviour can be changed by subclasses.
getMBeanServerConnection
in interface MBeanServerConnectionFactory
MBeanServerConnection
interface by forwarding its
methods to the remote MBean server.
IOException
- if a valid
MBeanServerConnection
cannot be created.JMXConnector.getMBeanServerConnection()
,
JMXConnector.getMBeanServerConnection(Subject)
public void addConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
MBeanServerConnectionFactory
Adds a listener to be informed of changes in connection
status. The listener will receive notifications of type JMXConnectionNotification
. An implementation can send other
types of notifications too.
Any number of listeners can be added with this method. The
same listener can be added more than once with the same or
different values for the filter and handback. There is no
special treatment of a duplicate entry. For example, if a
listener is registered twice with no filter, then its
handleNotification
method will be called twice for
each notification.
addConnectionNotificationListener
in interface MBeanServerConnectionFactory
listener
- a listener to receive connection status
notifications.filter
- a filter to select which notifications are to be
delivered to the listener, or null if all notifications are to
be delivered.handback
- an object to be given to the listener along
with each notification. Can be null.MBeanServerConnectionFactory.removeConnectionNotificationListener(javax.management.NotificationListener)
,
NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundException
MBeanServerConnectionFactory
Removes a listener from the list to be informed of changes in status. The listener must previously have been added. If there is more than one matching listener, all are removed.
removeConnectionNotificationListener
in interface MBeanServerConnectionFactory
listener
- a listener to receive connection status
notifications.
ListenerNotFoundException
- if the listener is not
registered with this JMXConnector
.MBeanServerConnectionFactory.removeConnectionNotificationListener(NotificationListener,
NotificationFilter, Object)
,
MBeanServerConnectionFactory.addConnectionNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
,
NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeConnectionNotificationListener(NotificationListener l, NotificationFilter f, Object handback) throws ListenerNotFoundException
MBeanServerConnectionFactory
Removes a listener from the list to be informed of changes in status. The listener must previously have been added with the same three parameters. If there is more than one matching listener, only one is removed.
removeConnectionNotificationListener
in interface MBeanServerConnectionFactory
l
- a listener to receive connection status notifications.f
- a filter to select which notifications are to be
delivered to the listener. Can be null.handback
- an object to be given to the listener along
with each notification. Can be null.
ListenerNotFoundException
- if the listener is not
registered with this JMXConnector
, or is not
registered with the given filter and handback.MBeanServerConnectionFactory.removeConnectionNotificationListener(NotificationListener)
,
MBeanServerConnectionFactory.addConnectionNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
,
NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public String getConnectionId() throws IOException
MBeanServerConnectionFactory
Gets the current connection's ID from the connector server. For a given connector server, every connection will have a unique id which does not change during the lifetime of the connection.
If this MBeanServerConnectionFactory provides access to
a remote MBeanServer, then the connection ID will be the ID of the
underlying JMXConnector's connection currently in use. The
javax.management.remote
package description
describes the conventions for such connection
IDs. Otherwise, the format of the connection ID is undefined.
getConnectionId
in interface MBeanServerConnectionFactory
JMXConnectionNotification
s.
IOException
- if the connection ID cannot be obtained,
for instance because the connection is closed or broken.public static MBeanServerConnectionFactory newInstance(JMXServiceURL url) throws IOException
newInstance(url,null,null)
.
url
- A JMX Service URL from which to create a
JMXConnector.
IOException
- if a connected connector cannot be obtained
from the JMXConnectorFactory
.public static MBeanServerConnectionFactory newInstance(JMXServiceURL url, Map map) throws IOException
newInstance(url,map,null)
.
url
- A JMX Service URL from which to create a
JMXConnector.map
- An attributes map passed to the JMXConnectorFactory.connect(JMXServiceURL,Map)
method.
IOException
- if a connected connector cannot be obtained
from the JMXConnectorFactory
.public static MBeanServerConnectionFactory newInstance(JMXServiceURL url, Map map, Subject subject) throws IOException
newInstance(JMXConnectorFactory.connect(url,map),subject)
.
url
- A JMX Service URL from which to create a
JMXConnector.map
- An attributes map passed to the JMXConnectorFactory.connect(JMXServiceURL,Map)
method.subject
- A subject for the underlying
MBeanServerConnection.
IOException
- if a connected connector cannot be obtained
from the JMXConnectorFactory
.JMXConnector.getMBeanServerConnection(Subject)
public static MBeanServerConnectionFactory newInstance(JMXConnector c)
new BasicMBeanServerConnectionFactory(c,null)
.
c
- A JMXConnector. The connector must be connected
before the returned factory can be used.public static MBeanServerConnectionFactory newInstance(JMXConnector c, Subject subject)
new BasicMBeanServerConnectionFactory(c,subject)
.
c
- A JMXConnector. The connector must be connected
before the returned factory can be used.subject
- A subject for the underlying
MBeanServerConnection.JMXConnector.getMBeanServerConnection(Subject)
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |