< prev index next >

application/org.openjdk.jmc.rjmx/src/main/java/org/openjdk/jmc/rjmx/internal/RJMXConnection.java

Print this page




  58 import javax.management.Notification;
  59 import javax.management.NotificationListener;
  60 import javax.management.ObjectName;
  61 import javax.management.QueryExp;
  62 import javax.management.ReflectionException;
  63 import javax.management.remote.JMXConnectionNotification;
  64 import javax.management.remote.JMXConnector;
  65 import javax.management.remote.JMXConnectorFactory;
  66 import javax.management.remote.JMXServiceURL;
  67 import javax.rmi.ssl.SslRMIClientSocketFactory;
  68 
  69 import org.eclipse.core.runtime.ListenerList;
  70 import org.openjdk.jmc.common.version.JavaVersion;
  71 import org.openjdk.jmc.common.version.JavaVersionSupport;
  72 import org.openjdk.jmc.rjmx.ConnectionException;
  73 import org.openjdk.jmc.rjmx.ConnectionToolkit;
  74 import org.openjdk.jmc.rjmx.IConnectionDescriptor;
  75 import org.openjdk.jmc.rjmx.IServerDescriptor;
  76 import org.openjdk.jmc.rjmx.RJMXPlugin;
  77 import org.openjdk.jmc.rjmx.services.IOperation;
  78 import org.openjdk.jmc.rjmx.services.internal.MBeanOperationsWrapper;
  79 import org.openjdk.jmc.rjmx.subscription.IMBeanHelperService;
  80 import org.openjdk.jmc.rjmx.subscription.IMBeanServerChangeListener;
  81 import org.openjdk.jmc.rjmx.subscription.IMRIService;
  82 import org.openjdk.jmc.rjmx.subscription.MRI;
  83 import org.openjdk.jmc.rjmx.subscription.internal.AttributeValueToolkit;
  84 import org.openjdk.jmc.rjmx.subscription.internal.InvoluntaryDisconnectException;
  85 import org.openjdk.jmc.rjmx.subscription.internal.MBeanMRIMetadataDB;
  86 import org.openjdk.jmc.ui.common.jvm.JVMDescriptor;
  87 
  88 /**
  89  * This class simplifies and hides some of the complexity of connecting to a JVM (supporting JSR-174
  90  * and JSR-160) using Remote JMX. The RJMXConnection is shared between several
  91  * {@link DefaultConnectionHandle}s, and when the last {@link DefaultConnectionHandle} using the
  92  * JRMXConnection is closed, the RJMXConnection will be automatically closed.
  93  */
  94 public class RJMXConnection implements Closeable, IMBeanHelperService {
  95 
  96         public final static String KEY_SOCKET_FACTORY = "com.sun.jndi.rmi.factory.socket"; //$NON-NLS-1$
  97 
  98         /**


 561                 m_mbeanListeners.add(listener);
 562         }
 563 
 564         @Override
 565         public Map<MRI, Map<String, Object>> getMBeanMetadata(ObjectName mbean) {
 566                 return m_mbeanDataProvider.getMBeanData(mbean);
 567         }
 568 
 569         /**
 570          * Returns the IOperations available for the specified MBean.
 571          *
 572          * @param mbean
 573          *            the MBean for which to return the information.
 574          * @return the operations that can be invoked on this mbean.
 575          * @throws Exception
 576          *             if the connection failed or some other problem occurred when trying create
 577          *             operations.
 578          */
 579         public Collection<IOperation> getOperations(ObjectName mbean) throws Exception {
 580                 MBeanServerConnection srv = ensureConnected();
 581                 return new MBeanOperationsWrapper(mbean, srv.getMBeanInfo(mbean).getOperations(), srv);
 582         }
 583 
 584         IMRIService getMRIService() {
 585                 return m_mbeanDataProvider;
 586         }
 587 
 588 }


  58 import javax.management.Notification;
  59 import javax.management.NotificationListener;
  60 import javax.management.ObjectName;
  61 import javax.management.QueryExp;
  62 import javax.management.ReflectionException;
  63 import javax.management.remote.JMXConnectionNotification;
  64 import javax.management.remote.JMXConnector;
  65 import javax.management.remote.JMXConnectorFactory;
  66 import javax.management.remote.JMXServiceURL;
  67 import javax.rmi.ssl.SslRMIClientSocketFactory;
  68 
  69 import org.eclipse.core.runtime.ListenerList;
  70 import org.openjdk.jmc.common.version.JavaVersion;
  71 import org.openjdk.jmc.common.version.JavaVersionSupport;
  72 import org.openjdk.jmc.rjmx.ConnectionException;
  73 import org.openjdk.jmc.rjmx.ConnectionToolkit;
  74 import org.openjdk.jmc.rjmx.IConnectionDescriptor;
  75 import org.openjdk.jmc.rjmx.IServerDescriptor;
  76 import org.openjdk.jmc.rjmx.RJMXPlugin;
  77 import org.openjdk.jmc.rjmx.services.IOperation;

  78 import org.openjdk.jmc.rjmx.subscription.IMBeanHelperService;
  79 import org.openjdk.jmc.rjmx.subscription.IMBeanServerChangeListener;
  80 import org.openjdk.jmc.rjmx.subscription.IMRIService;
  81 import org.openjdk.jmc.rjmx.subscription.MRI;
  82 import org.openjdk.jmc.rjmx.subscription.internal.AttributeValueToolkit;
  83 import org.openjdk.jmc.rjmx.subscription.internal.InvoluntaryDisconnectException;
  84 import org.openjdk.jmc.rjmx.subscription.internal.MBeanMRIMetadataDB;
  85 import org.openjdk.jmc.ui.common.jvm.JVMDescriptor;
  86 
  87 /**
  88  * This class simplifies and hides some of the complexity of connecting to a JVM (supporting JSR-174
  89  * and JSR-160) using Remote JMX. The RJMXConnection is shared between several
  90  * {@link DefaultConnectionHandle}s, and when the last {@link DefaultConnectionHandle} using the
  91  * JRMXConnection is closed, the RJMXConnection will be automatically closed.
  92  */
  93 public class RJMXConnection implements Closeable, IMBeanHelperService {
  94 
  95         public final static String KEY_SOCKET_FACTORY = "com.sun.jndi.rmi.factory.socket"; //$NON-NLS-1$
  96 
  97         /**


 560                 m_mbeanListeners.add(listener);
 561         }
 562 
 563         @Override
 564         public Map<MRI, Map<String, Object>> getMBeanMetadata(ObjectName mbean) {
 565                 return m_mbeanDataProvider.getMBeanData(mbean);
 566         }
 567 
 568         /**
 569          * Returns the IOperations available for the specified MBean.
 570          *
 571          * @param mbean
 572          *            the MBean for which to return the information.
 573          * @return the operations that can be invoked on this mbean.
 574          * @throws Exception
 575          *             if the connection failed or some other problem occurred when trying create
 576          *             operations.
 577          */
 578         public Collection<IOperation> getOperations(ObjectName mbean) throws Exception {
 579                 MBeanServerConnection srv = ensureConnected();
 580                 return MBeanOperationWrapper.createOperations(mbean, srv.getMBeanInfo(mbean).getOperations(), srv);
 581         }
 582 
 583         IMRIService getMRIService() {
 584                 return m_mbeanDataProvider;
 585         }
 586 
 587 }
< prev index next >