Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.net
Interface Monitor

All Known Subinterfaces:
BandwidthMonitor, CommandMonitor, ConnectionMonitor
All Known Implementing Classes:
BasicTransientMonitor, CommandMonitorImpl, TransientBandwidthMonitor, TransientConnectionMonitor

public interface Monitor

Monitors a network usage.

Monitors measure sample totals, and sample rate (samples per second). Monitor information is used at runtime to adjust server behavior as well as to generate reports on server history.

Based in part on the DataMonitor from Java Distributed Computing, Jim Farley, O'Reilly.


Method Summary
 void addSample(long quantity)
          Add the number of samples that occured between the last sample date, and the current time.
 void addSample(long quantity, long startTime, long endTime)
          Add the number of samples that occured between the given start and end times.
 java.util.Date getFirstSampleDate()
          The date-time of the first sample reported to the monitor.
 float getFrameRate()
          Obtain the number of bytes read during the frame.
 int getFrameSize()
          The size of the moving frame (in sample events) that provides a recent view of the data.
 long getFrameTotal()
          Obtain the sample total during the frame.
 long getFrameTotalTime()
          Obtain the total sample time during the frame.
 java.util.Date getLastSampleDate()
          The date-time of the last sample reported to the monitor.
 float getRate()
          Obtain the rate of samples reported during the monitor's lifetime.
 long getTotal()
          Obtain the total number of samples reported during the monitor's lifetime.
 long getTotalTime()
          Obtain the total amount of time (in milliseconds) that the monitor has samples for.
 void setFrameSize(int frameSize)
          Sets the size of the moving frame (in sample events).
 

Method Detail

addSample

void addSample(long quantity,
               long startTime,
               long endTime)

Add the number of samples that occured between the given start and end times.

The monitor does not check for overlapping sample times. It is the caller's responsibility to ensure samples don't overlap. Failure to prevent overlapping sample times may result in elapsed time being falsely counted and reported.

Parameters:
quantity - the number of samples that occurred during the sample period.
startTime - the beginning of the sample period (system time millis).
endTime - the end of the sample period (system time millis).

addSample

void addSample(long quantity)

Add the number of samples that occured between the last sample date, and the current time.

A convenience method when samples occur in sequential periods. Equivalent to:


 monitor.addSample(quantity, monitor.getLastSampleDate(), new Date());
 

Parameters:
quantity - the number of samples that occurred between the last sample date and now

getTotal

long getTotal()

Obtain the total number of samples reported during the monitor's lifetime.

Returns:
the total number of samples reported to the monitor.

getTotalTime

long getTotalTime()

Obtain the total amount of time (in milliseconds) that the monitor has samples for.

Returns:
the total time (in milliseconds) samples have been recorded for.

getRate

float getRate()

Obtain the rate of samples reported during the monitor's lifetime.

Returns:
the average rate of samples reported to the monitor.

getFirstSampleDate

java.util.Date getFirstSampleDate()

The date-time of the first sample reported to the monitor.

Returns:
the date-time of the first sample reported to the monitor.

getLastSampleDate

java.util.Date getLastSampleDate()

The date-time of the last sample reported to the monitor.

Returns:
the date-time of the last sample reported to the monitor.

getFrameSize

int getFrameSize()

The size of the moving frame (in sample events) that provides a recent view of the data.

Samples can be monitored and managed based on the usage within the most recent number of samples reported during the frame. Larger frame sizes 'smooths' the results creating frame statistics that are less affected by outlying samples but requiring larger amounts of memory to store and more resources to calculate frame statistics.

Returns:
the sample frame size in seconds.

setFrameSize

void setFrameSize(int frameSize)

Sets the size of the moving frame (in sample events).

Changing the frame size to a larger value will not automatically include past samples that were previously outside the frame. Instead, the monitor will not return accurate frame related data until the new frame is filled with new data.

Warning: Larger frame sizes consume larger amounts of memory per monitor and increases the amount of work required to generate frame statistics. Set the framesize to the smallest useful size or zero to not record any frame related data.

Parameters:
frameSize - the new size of the sample frame in seconds.

getFrameTotal

long getFrameTotal()

Obtain the sample total during the frame.

Returns:
the sample total during the frame.

getFrameTotalTime

long getFrameTotalTime()

Obtain the total sample time during the frame.

Returns:
the total sample time during the frame.

getFrameRate

float getFrameRate()

Obtain the number of bytes read during the frame.

Returns:
the number of bytes read during the frame.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.