Methods Summary |
---|
private com.sun.cli.jmx.support.CLISupportMBeanProxy | createProxy(javax.management.MBeanServerConnection managedServer, boolean runLocally)
CLISupportMBeanProxy proxy = null;
AliasMgrMBean aliasMgr = null;
CLISupportMBean cliSupport = null;
if ( runLocally )
{
final AliasMgrHashMapImpl aliasMgrImpl = new AliasMgrHashMapImpl();
aliasMgrImpl.load( AliasMgrHashMapImpl.DEFAULT_FILENAME );
aliasMgr = new AliasMgr( aliasMgrImpl );
StandardAliasesIniter.init( aliasMgr );
cliSupport = new CLISupport( managedServer, aliasMgr );
}
else
{
aliasMgr = CLISupportMBeanProxy.createAliasMgrProxy( managedServer );
cliSupport = CLISupportMBeanProxy.createCLISupportProxy( managedServer );
}
proxy = new CLISupportMBeanProxy( aliasMgr, cliSupport);
return( proxy );
|
private static javax.management.remote.JMXConnector | establishConnection(java.lang.String host, int port)
final JMXServiceURL url = new JMXServiceURL( "service:jmx:jmxmp://" + host + ":" + port );
JMXConnector conn = JMXConnectorFactory.connect( url );
return( conn );
|
public static void | main(java.lang.String[] args)
try
{
final ArgHelperOptionsInfo optionInfo = new ArgHelperOptionsInfo( OPTIONS );
final ListIterator iter = Arrays.asList( args ).listIterator();
final ArgHelper argHelper = new ArgHelperImpl( iter, optionInfo);
final Integer port = argHelper.getInteger( "--port" );
final String host = argHelper.getString( "--host", "localhost");
final boolean interactive = argHelper.getBoolean( "--interactive", Boolean.FALSE).booleanValue();
final boolean runLocally = argHelper.getBoolean( "--localsupport", Boolean.FALSE ).booleanValue();
if ( port == null )
{
System.out.println( "USAGE: TestClient --port=<port-number>" );
System.exit( 1 );
}
final TestClientMain testMain = new TestClientMain( );
new StringifierRegistryIniter();
final JMXConnector jmxConnector = establishConnection( host, port.intValue() );
final MBeanServerConnection conn = jmxConnector.getMBeanServerConnection();
p( "Connected to: " + host + ":" + port );
p( ( runLocally ? "Running with local CLI support.":"Running with remote CLI support") );
//testMain.testNotifications( host, port.intValue() );
testMain.testCLISupport( conn, runLocally );
}
catch( Exception e )
{
p( e );
}
|
long | now()
return( System.currentTimeMillis() );
|
private static void | p(java.lang.Object arg)
System.out.println( arg.toString() );
|
private void | testCLISupport(javax.management.MBeanServerConnection conn, boolean runLocally)
final CLISupportMBeanProxy proxy = createProxy( conn, runLocally );
final CLISupportTester tester = new CLISupportTester( conn, proxy );
tester.Run();
|
private void | testNotifications(java.lang.String host, int port)
System.out.println( "Testing: " + host + ":" + port + ", threads = " + mNumThreads );
final int kNumInvokes = 1 * 1024;
mStartTime = System.currentTimeMillis();
for( int i = 0; i < mNumThreads; ++i )
{
NotificationTester test = new NotificationTester( host, port);
// test.RunMultiplePerConnectionThreaded( "" + i, 1000, kNumInvokes, this);
test.RunNotifTest( 0 );
}
|
public void | throughputReport(long milliseconds, long numCalls)
String progString = "";
synchronized ( mCritical )
{
mTotalNumCalls += numCalls;
++mNumAveraged;
if ( mNumAveraged > mNumThreads * 8 )
{
// reset periodically so we don't get hurt by blips in poor performance
mMilliseconds = 0;
mNumCalls = 0;
mNumAveraged = 0;
}
mMilliseconds += milliseconds;
mNumCalls += numCalls;
final double rollingCallsPerSec = mNumCalls / ((mMilliseconds / 1000.0) / (double)mNumThreads);
final double totalCallsPerSec = mTotalNumCalls / ((now() - mStartTime) / 1000.0);
progString = mNumThreads + " threads: " +
(long)rollingCallsPerSec + " (rolling) " +
(long)totalCallsPerSec + " (total)";
}
// keep p() outside synchronized section
p( progString );
|