/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
*
* A test "management tool" used by unit test LocalManagementTest.sh.
*
* Usage: java TestManager <pid> <port>
*
* where <pid> is the process-id of the test application, and <port> is
* TCP port is used to shutdown the application.
*/
// Sun specific
// Sun implementation specific
public class TestManager {
/*
* Starts the management agent in the target VM
*/
/*
* with development/non-images builds
*/
if (!f.exists()) {
"management-agent.jar";
if (!f.exists()) {
throw new RuntimeException("management-agent.jar missing");
}
}
agent = f.getCanonicalPath();
try {
} catch (Exception x) {
throw new IOException(x.getMessage());
}
}
throw new RuntimeException("Local connector address for " +
pid + " is null");
}
RUNTIME_MXBEAN_NAME, RuntimeMXBean.class);
// close the connection
c.close();
}
"com.sun.management.jmxremote.localConnectorAddress";
if (agentPropLocalConnectorAddress == null &&
// No JMX Connector address so attach to VM, and load
// management-agent.jar
}
// Test address obtained from agent properties
// Test address obtained from jvmstat buffer
// Shutdown application
s.close();
}
}