* @throws Exception
*/
private void createJMXServerConnection(ManagedServer server) throws Exception
{
// Currently Qpid Management Console only supports JMX MBeanServer
JMXServerRegistry serverRegistry = new JMXServerRegistry(server);
try
{
//determine the management API version of the server just connected to
MBeanUtility.classifyManagementApiVersion(server, serverRegistry);
}
catch (Exception e)
{
//Exception classifying the server API, clean up the connection and rethrow
serverRegistry.closeServerConnection();
throw e;
}
//check that the console supports the API major version encountered, otherwise abort.
ApiVersion serverAPI = serverRegistry.getManagementApiVersion();
int serverMajor = serverAPI.getMajor();
int supportedMajor = ApplicationRegistry.SUPPORTED_QPID_JMX_API_MAJOR_VERSION;
if(serverMajor > supportedMajor)
{
serverRegistry.closeServerConnection();
throw new ManagementConsoleException("The server management API version encountered is not supported"
+ " by this console release. Please check for an updated console release.");
}
//connection succeeded, add the ServerRegistry to the ApplicationRegistry