org.codehaus.activemq.capacity
Class DelegateCapacityMonitor

java.lang.Object
  extended byorg.codehaus.activemq.capacity.DelegateCapacityMonitor
All Implemented Interfaces:
CapacityMonitor
Direct Known Subclasses:
DefaultBroker

public class DelegateCapacityMonitor
extends Object
implements CapacityMonitor

BasicCapacityMonitor implementation

Version:
$Revision: 1.1 $

Nested Class Summary
 
Nested classes inherited from class org.codehaus.activemq.capacity.CapacityMonitor
CapacityMonitor.BasicCapacityMonitor
 
Field Summary
(package private)  CopyOnWriteArrayList listeners
           
(package private)  CapacityMonitor monitor
           
(package private)  String name
           
 
Constructor Summary
DelegateCapacityMonitor()
          Construct a DelegateCapacityMonitor
DelegateCapacityMonitor(String name, CapacityMonitor cm)
          Construct a DelegateCapacityMonitor
 
Method Summary
 void addCapacityEventListener(CapacityMonitorEventListener l)
          Add a CapacityEventListener
 int getCurrentCapacity()
          Get the current capscity of the service as a percentage
 long getCurrentValue()
          Get the current value of the CapacityMonitor
 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 CapacityEventListener
 void setCurrentValue(long newCurrentValue)
          set the current value of the capacity
 void setDelegate(CapacityMonitor cm)
          Set the delegated one
 void setName(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

String name

monitor

CapacityMonitor monitor

listeners

CopyOnWriteArrayList listeners
Constructor Detail

DelegateCapacityMonitor

public DelegateCapacityMonitor()
Construct a DelegateCapacityMonitor


DelegateCapacityMonitor

public DelegateCapacityMonitor(String name,
                               CapacityMonitor cm)
Construct a DelegateCapacityMonitor

Parameters:
name -
cm -
Method Detail

setDelegate

public void setDelegate(CapacityMonitor cm)
Set the delegated one

Parameters:
cm -

getName

public String getName()
Get the name of the CapacityMonitor

Specified by:
getName in interface CapacityMonitor
Returns:

setName

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

Specified by:
setName in interface CapacityMonitor
Parameters:
newName -

getRoundingFactor

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

Specified by:
getRoundingFactor in interface CapacityMonitor
Returns:
the rounding factor

setRoundingFactor

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

Specified by:
setRoundingFactor in interface CapacityMonitor
Parameters:
newRoundingFactor -

addCapacityEventListener

public void addCapacityEventListener(CapacityMonitorEventListener l)
Add a CapacityEventListener

Specified by:
addCapacityEventListener in interface CapacityMonitor
Parameters:
l -

removeCapacityEventListener

public void removeCapacityEventListener(CapacityMonitorEventListener l)
Remove a CapacityEventListener

Specified by:
removeCapacityEventListener in interface CapacityMonitor
Parameters:
l -

getCurrentCapacity

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

Specified by:
getCurrentCapacity in interface CapacityMonitor
Returns:

getRoundedCapacity

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

Specified by:
getRoundedCapacity in interface CapacityMonitor
Returns:

getCurrentValue

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

Specified by:
getCurrentValue in interface CapacityMonitor
Returns:

setCurrentValue

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

Specified by:
setCurrentValue in interface CapacityMonitor
Parameters:
newCurrentValue -

getValueLimit

public long getValueLimit()
Specified by:
getValueLimit in interface CapacityMonitor
Returns:
The upper limit of the value of the CapacityMonitor

setValueLimit

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

Specified by:
setValueLimit in interface CapacityMonitor
Parameters:
newValueLimit -


Copyright © 2004 Protique, Ltd.. All Rights Reserved.