# Class MonitorAccumModel

java.lang.Object
org.apache.jmeter.visualizers.MonitorAccumModel

All Implemented Interfaces:
  `Serializable, Clearable`

public class MonitorAccumModel extends Object implements Clearable, Serializable

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`MonitorAccumModel()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addListener(MonitorListener listener)`
Add a listener.
`void`
`addSample(SampleResult sample)`
Method will try to parse the response data.
`void`
`addSample(MonitorModel model)`
Method will look up the server in the map.
`void`
`clearData()`
Clears everything except the listener.
`MonitorModel`
`createNewMonitorModel(URL url)`
Method will return a new MonitorModel object with the given URL.
`List<MonitorModel>`
`getAllSamples(String url)`
Get all MonitorModels matching the URL.
`int`
`getBufferSize()`
`MonitorModel`
`getLastSample()`
Added this method we that we can save the calculated stats.
`MonitorModel`
`getSample(String url)`
Get the MonitorModel matching the url.
`void`
`noResponse(URL url)`
If there is no response from the server, we create a new MonitorStats object with the current timestamp and health "dead".
`void`
`notifyListeners(MonitorModel model)`
notify the listeners with the MonitorModel object.
`void`
`setBufferSize(int buffer)`
`void`
`setPrefix(String prefix)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MonitorAccumModel

public MonitorAccumModel()

## Method Details

### getBufferSize

public int getBufferSize()

### setBufferSize

public void setBufferSize(int buffer)

### setPrefix

public void setPrefix(String prefix)

### getLastSample

public MonitorModel getLastSample()
Added this method we that we can save the calculated stats.

Returns:
  current sample

### addSample

public void addSample(MonitorModel model)
Method will look up the server in the map. The MonitorModel will be added to an existing list, or a new one will be created.

Parameters:
  `model` - the `MonitorModel` to be added

### getAllSamples

public List<MonitorModel> getAllSamples(String url)
Get all MonitorModels matching the URL.

Parameters:
  `url` - to be matched against
Returns:
  list

### getSample

public MonitorModel getSample(String url)
Get the MonitorModel matching the url.

Parameters:
  `url` - to be matched against
Returns:
  the first `MonitorModel` registered for this `url`

### addSample

public void addSample(SampleResult sample)
Method will try to parse the response data. If the request was a monitor request, but the response was incomplete, bad or the server refused the connection, we will set the server's health to "dead". If the request was not a monitor sample, the method will ignore it.

Parameters:
  `sample` - `SampleResult` with the result of the status request

### noResponse

public void noResponse(URL url)
If there is no response from the server, we create a new MonitorStats object with the current timestamp and health "dead".

Parameters:
  `url` - URL from where the status should have come

### createNewMonitorModel

public MonitorModel createNewMonitorModel(URL url)
Method will return a new MonitorModel object with the given URL. This is used when the server fails to respond fully, or is dead.

Parameters:
  `url` - URL from where the status should have come
Returns:
  new MonitorModel

### clearData

public void clearData()
Clears everything except the listener. Do not clear the listeners. If we clear listeners, subsequent "run" will not notify the gui of data changes.

Specified by:
  `clearData` in interface `Clearable`

### notifyListeners

public void notifyListeners(MonitorModel model)
notify the listeners with the MonitorModel object.

Parameters:
  `model` - the `MonitorModel` that should be sent to the listeners

### addListener

public void addListener(MonitorListener listener)
Add a listener. When samples are added, the class will notify the listener of the change.

Parameters:
  `listener` - the `MonitorListener` that should be added