org.openware.loadsim.simulation
Class Simulation

java.lang.Object
  |
  +--org.openware.loadsim.simulation.Simulation
All Implemented Interfaces:
ISimulation, java.rmi.Remote, java.lang.Runnable

public class Simulation
extends java.lang.Object
implements java.lang.Runnable, ISimulation

Main class for the simulation. Handles the virtual users as well as starting and stopping the simulation.

Author:
Vincent Sheffer

Constructor Summary
Simulation()
           
Simulation(Config config, Sequence seq)
           
 
Method Summary
 java.lang.String fetchResults()
           
 java.lang.String getHostname()
          Get the hostname of the machine that this simulation is runing on.
 int getNumRunning()
           
 IResults getResults()
           
 java.lang.String getResultsFileName()
           
 int getTotalVirtualUsers()
           
 boolean isRunning()
           
 void run()
          Start the simulation thread.
 void startSimulation()
          Start the simulation.
 void stopSimulation()
          Stop the simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simulation

public Simulation()

Simulation

public Simulation(Config config,
                  Sequence seq)
           throws java.io.IOException
Method Detail

getHostname

public java.lang.String getHostname()
Get the hostname of the machine that this simulation is runing on.
Specified by:
getHostname in interface ISimulation

getResults

public IResults getResults()

startSimulation

public void startSimulation()
Start the simulation. This will iterate through each virtual user and start them running. Once all of the VirtualUsers are running in their own threads this method exits.

If you want to stop the simulation call the stopSimulation method.

Specified by:
startSimulation in interface ISimulation

isRunning

public boolean isRunning()
Specified by:
isRunning in interface ISimulation

run

public void run()
Start the simulation thread. This thread will wake up every 5 seconds and check to see if the virtual users are still alive. As long as just one virtual user is still alive this thread will continue running. Once all of the virtual users are dead this thread will do some clean up and then exit.
Specified by:
run in interface java.lang.Runnable

getTotalVirtualUsers

public int getTotalVirtualUsers()
Specified by:
getTotalVirtualUsers in interface ISimulation

getNumRunning

public int getNumRunning()
Specified by:
getNumRunning in interface ISimulation

stopSimulation

public void stopSimulation()
Stop the simulation. This will iterate through each VirtualUser and tell them to die. The next iteration will cause the simulation to stop because all of the virutal users are dead.
Specified by:
stopSimulation in interface ISimulation

getResultsFileName

public java.lang.String getResultsFileName()
Specified by:
getResultsFileName in interface ISimulation

fetchResults

public java.lang.String fetchResults()
                              throws java.io.IOException
Specified by:
fetchResults in interface ISimulation


Copyright © 2000, 2001 Openware, Spin Software. All Rights Reserved.