JMXMonitor.java revision d81978a0815d5b8a75633c35e3e1f8708d36f017
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
*/
/**
* Producer who monitor an OpenDS server with JMX.
*/
public class JMXMonitor extends Thread {
/**
* Main class of the client.
*/
private MonitoringClient client;
private Properties params;
/**
* Construct a JMXMonitor thread with the specified values.
*
* @param client The main class of the client.
* @param params The parameters of the thread.
*/
}
/**
* Connect to the server, get the attributes to monitor,
* and wait a notify from the main thread.
*/
public void run() {
// Initialise the JMX environnement
}
while(true) {
try {
// Allow to desynchronize the producers.
try {
client.getTimeUnit());
} catch (InterruptedException e) {
}
// Connect to the server
"/org.opends.server.protocols.jmx.client-unknown");
} else {
"/jmxrmi");
}
// Simulate an important charge for the server
try {
client.getTimeUnit());
} catch (InterruptedException e) {
}
// Retrieve the attributes
for (Data d : attributesToMonitor) {
try {
d.getAttribute());
try {
} catch (ClassCastException e) {
}
} else {
"be retrieved");
}
} catch (InstanceNotFoundException e) {
"exist in the repository");
}
}
// Close the JMX connection
// Processing of the errors
} catch (UnmarshalException e) {
"Invalid credentials");
} catch (SecurityException e) {
"Invalid credentials");
} catch (IOException e) {
"Wrong port number");
e.getCause() instanceof CommunicationException) {
"Unknown host");
} else {
e.getLocalizedMessage());
}
} catch (JMException e) {
e.getLocalizedMessage());
}
// Wait for the next run
try {
synchronized(MonitoringClient.lock) {
}
} catch (InterruptedException e) {
}
// Update the date
}
}
}