1 /***
2 *
3 * Copyright 2004 Protique Ltd
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 **/
18
19
20 package org.codehaus.activemq.capacity;
21 /***
22 * Fires CapacityChangedEvents
23 *
24 * @version $Revision: 1.3 $
25 */
26 public interface CapacityMonitor {
27
28 /***
29 *
30 * A CapacityMonitor holds percentage values
31 * for some resource that has a capacity -
32 * e.g. a MemoryBoundedQueue
33 * @version $Revision: 1.3 $
34 */
35 public class BasicCapacityMonitor{
36
37 }
38 /***
39 * Get the name of the CapacityMonitor
40 * @return the name
41 */
42 public String getName();
43
44 /***
45 * Set the name of the CapacityMonitor
46 * @param newName
47 */
48 public void setName(String newName);
49
50 /***
51 * Get the rounding factor - default is 10
52 * @return the rounding factor
53 */
54 public int getRoundingFactor();
55
56 /***
57 * Set the rounding factor (between 1-100)
58 * @param newRoundingFactor
59 */
60 public void setRoundingFactor(int newRoundingFactor);
61
62 /***
63 * Add a CapacityMonitorEventListener
64 *
65 * @param l
66 */
67 public void addCapacityEventListener(CapacityMonitorEventListener l);
68
69 /***
70 * Remove a CapacityMonitorEventListener
71 *
72 * @param l
73 */
74 public void removeCapacityEventListener(CapacityMonitorEventListener l);
75
76 /***
77 * Get the current capacity of the service as a percentage
78 *
79 * @return
80 */
81 public int getCurrentCapacity();
82
83 /***
84 * Calculates the capacity rounded down to the rounding factor
85 * @return
86 */
87 public int getRoundedCapacity();
88
89 /***
90 * Get the current value of the CapacityMonitor
91 *
92 * @return
93 */
94 public long getCurrentValue();
95
96 /***
97 * set the current value of the capacity
98 *
99 * @param newCurrentValue
100 */
101 public void setCurrentValue(long newCurrentValue);
102
103 /***
104 * @return The upper limit of the value of the CapacityMonitor
105 */
106 public long getValueLimit();
107
108 /***
109 * set a new value limit for the CapacityMonitor
110 *
111 * @param newValueLimit
112 */
113 public void setValueLimit(long newValueLimit);
114 }