Methods Summary |
---|
private javax.management.remote.JMXConnector | Connect(java.lang.String host, int port)
final JMXServiceURL url = new JMXServiceURL( "service:jmx:jmxmp://" + host + ":" + port );
JMXConnector conn = JMXConnectorFactory.connect( url );
return( conn );
|
public void | RunMultiplePerConnection(int outerCount, int numIterations)
final ObjectName name = new ObjectName( "foo" );
//final ObjectName name = new ObjectName( TestShared.kSimpleDynamicName );
for( int outer = 0; outer < outerCount; ++outer )
{
final long startTime = System.currentTimeMillis();
for( int i = 0; i < numIterations; ++i )
{
Object result = mServer.getAttribute( name, "NotifsEmitted" );
}
final long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
//p( mName + ": " + numIterations / (elapsed / 1000.0) + " iterations/sec" );
mThroughputCallback.throughputReport( elapsed, numIterations );
}
|
public void | RunMultiplePerConnectionThreaded(java.lang.String name, int outerLoop, int numIterations, com.sun.cli.jmx.test.NotificationTester$ThroughputCallback throughputCallback)
mName = name;
mOuterLoop = outerLoop;
mNumIterations = numIterations;
mThroughputCallback = throughputCallback;
this.start();
|
public void | RunNotifTest(long sleepMillis)
final ObjectName emitterName = new ObjectName(CLISupportStrings.CLI_SIMPLE_TESTEE_TARGET);
mNotifCount = 0;
boolean success = false;
try {
p("adding listener");
mServer.addNotificationListener(emitterName, this, null, null);
p("setting attribute");
mServer.setAttribute(emitterName,
new Attribute("NotifMillis",
Long.valueOf(sleepMillis)));
p("starting");
mServer.invoke(emitterName, "startNotif", null, null);
success = true;
p("started");
}
catch (Exception e) {
p("caught exception: " + e);
}
long startTime = System.currentTimeMillis();
while (true) {
Thread.sleep(500);
final long notifCount = mNotifCount;
final long elapsedMillis = System.currentTimeMillis() -
startTime;
final double rate = (double) notifCount /
(elapsedMillis / 1000.0);
System.out.println("total notifications: " + notifCount + " = " +
(rate * 10.0) / 10.0 + "/sec");
}
|
public void | RunSinglePerConnection(int numConnections)
final long startTime = System.currentTimeMillis();
final ObjectName name = new ObjectName( CLISupportStrings.CLI_SUPPORT_TARGET );
for( int i = 0; i < numConnections; ++i )
{
JMXConnector conn = Connect( mHost, mPort );
MBeanServerConnection server = conn.getMBeanServerConnection( );
Object result = server.getAttribute( name, "NbChanges" );
conn.close();
}
final long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
p( "elapsed = " + elapsed );
p( "connections per second = " + numConnections / (elapsed / 1000.0) );
|
public void | handleNotification(javax.management.Notification notification, java.lang.Object handback)
++mNotifCount;
|
private static void | p(java.lang.Object arg)
System.out.println( arg.toString() );
|
public void | run()
try
{
RunMultiplePerConnection( mOuterLoop, mNumIterations );
}
catch( Exception e )
{
p( e );
}
|