1 23 24 29 30 package com.sun.appserv.management.util.jmx; 31 32 import java.io.IOException ; 33 34 import javax.management.MBeanServer ; 35 import javax.management.MBeanServerConnection ; 36 import javax.management.remote.JMXConnector ; 37 38 import com.sun.appserv.management.client.ConnectionSource; 39 40 41 45 public final class JMXConnectorConnectionSource 46 implements ConnectionSource 47 { 48 protected JMXConnector mJMXConnector; 49 50 public 51 JMXConnectorConnectionSource( final JMXConnector connector ) 52 throws IOException 53 { 54 if ( connector == null ) 55 { 56 throw new IllegalArgumentException (); 57 } 58 59 mJMXConnector = connector; 60 61 getMBeanServerConnection( false ); 63 } 64 65 66 67 public MBeanServerConnection 68 getExistingMBeanServerConnection( ) 69 { 70 try 71 { 72 return( mJMXConnector.getMBeanServerConnection() ); 73 } 74 catch( IOException e ) 75 { 76 } 77 return( null ); 78 } 79 80 public MBeanServerConnection 81 getMBeanServerConnection( boolean forceNew ) 82 throws IOException 83 { 84 return( mJMXConnector.getMBeanServerConnection() ); 85 } 86 87 90 public JMXConnector 91 getJMXConnector( final boolean forceNew ) 92 throws IOException 93 { 94 return( mJMXConnector ); 96 } 97 } 98 | Popular Tags |