Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.capacity
Class BasicCapacityMonitor  view BasicCapacityMonitor download BasicCapacityMonitor.java

java.lang.Object
  extended byorg.activemq.capacity.BasicCapacityMonitor
All Implemented Interfaces:
CapacityMonitor

public class BasicCapacityMonitor
extends java.lang.Object
implements CapacityMonitor

BasicCapacityMonitor implementation

Version:
$Revision: 1.1.1.1 $

Nested Class Summary
 
Nested classes inherited from class org.activemq.capacity.CapacityMonitor
CapacityMonitor.BasicCapacityMonitor
 
Field Summary
private  int currentCapacity
           
private  long currentValue
           
private  CopyOnWriteArrayList listeners
           
private  java.lang.String name
           
private  int roundedCapacity
           
private  int roundingFactor
           
private  long valueLimit
           
 
Constructor Summary
BasicCapacityMonitor(java.lang.String name, long valueLimit)
          Construct a CapacityMonitor
 
Method Summary
 void addCapacityEventListener(CapacityMonitorEventListener l)
          Add a CapacityMonitorEventListener
private  int calculateCapacity()
           
 CapacityMonitorEvent generateCapacityMonitorEvent()
           
 int getCurrentCapacity()
          Get the current capscity of the service as a percentage
 long getCurrentValue()
          Get the current value of the CapacityMonitor
 java.lang.String getName()
          Get the name of the CapacityMonitor
 int getRoundedCapacity()
          Calculates the capacity rounded down to the rounding factor
 int getRoundingFactor()
          Get the rounding factor - default is 10
 long getValueLimit()
           
 void removeCapacityEventListener(CapacityMonitorEventListener l)
          Remove a CapacityMonitorEventListener
 void setCurrentValue(long newCurrentValue)
          set the current value of the capacity
 void setName(java.lang.String newName)
          Set the name of the CapacityMonitor
 void setRoundingFactor(int newRoundingFactor)
          Set the rounding factor (between 1-100)
 void setValueLimit(long newValueLimit)
          set a new value limit for the CapacityMonitor
private  void updateCapacityChanged(int newRoundedCapacity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name

valueLimit

private long valueLimit

currentValue

private long currentValue

currentCapacity

private int currentCapacity

roundedCapacity

private int roundedCapacity

roundingFactor

private int roundingFactor

listeners

private CopyOnWriteArrayList listeners
Constructor Detail

BasicCapacityMonitor

public BasicCapacityMonitor(java.lang.String name,
                            long valueLimit)
Construct a CapacityMonitor

Method Detail

getName

public java.lang.String getName()
Get the name of the CapacityMonitor

Specified by:
getName in interface CapacityMonitor

setName

public void setName(java.lang.String newName)
Description copied from interface: CapacityMonitor
Set the name of the CapacityMonitor

Specified by:
setName in interface CapacityMonitor

getRoundingFactor

public int getRoundingFactor()
Get the rounding factor - default is 10

Specified by:
getRoundingFactor in interface CapacityMonitor

setRoundingFactor

public void setRoundingFactor(int newRoundingFactor)
Set the rounding factor (between 1-100)

Specified by:
setRoundingFactor in interface CapacityMonitor

addCapacityEventListener

public void addCapacityEventListener(CapacityMonitorEventListener l)
Add a CapacityMonitorEventListener

Specified by:
addCapacityEventListener in interface CapacityMonitor

removeCapacityEventListener

public void removeCapacityEventListener(CapacityMonitorEventListener l)
Remove a CapacityMonitorEventListener

Specified by:
removeCapacityEventListener in interface CapacityMonitor

getCurrentCapacity

public int getCurrentCapacity()
Get the current capscity of the service as a percentage

Specified by:
getCurrentCapacity in interface CapacityMonitor

getRoundedCapacity

public int getRoundedCapacity()
Calculates the capacity rounded down to the rounding factor

Specified by:
getRoundedCapacity in interface CapacityMonitor

getCurrentValue

public long getCurrentValue()
Get the current value of the CapacityMonitor

Specified by:
getCurrentValue in interface CapacityMonitor

setCurrentValue

public void setCurrentValue(long newCurrentValue)
set the current value of the capacity

Specified by:
setCurrentValue in interface CapacityMonitor

getValueLimit

public long getValueLimit()
Specified by:
getValueLimit in interface CapacityMonitor

setValueLimit

public void setValueLimit(long newValueLimit)
set a new value limit for the CapacityMonitor

Specified by:
setValueLimit in interface CapacityMonitor

generateCapacityMonitorEvent

public CapacityMonitorEvent generateCapacityMonitorEvent()
Specified by:
generateCapacityMonitorEvent in interface CapacityMonitor

updateCapacityChanged

private void updateCapacityChanged(int newRoundedCapacity)

calculateCapacity

private int calculateCapacity()