Committed by
Yuta Higuchi
Add probes to DistributedIntentStore
Change-Id: I23a5823d3924392dc17166404a17fc1918c01453
Showing
2 changed files
with
185 additions
and
2 deletions
... | @@ -15,6 +15,8 @@ | ... | @@ -15,6 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onlab.onos.store.intent.impl; | 16 | package org.onlab.onos.store.intent.impl; |
17 | 17 | ||
18 | +import com.codahale.metrics.Timer; | ||
19 | +import com.codahale.metrics.Timer.Context; | ||
18 | import com.google.common.base.Verify; | 20 | import com.google.common.base.Verify; |
19 | import com.google.common.collect.ImmutableSet; | 21 | import com.google.common.collect.ImmutableSet; |
20 | 22 | ||
... | @@ -24,6 +26,8 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -24,6 +26,8 @@ import org.apache.felix.scr.annotations.Deactivate; |
24 | import org.apache.felix.scr.annotations.Reference; | 26 | import org.apache.felix.scr.annotations.Reference; |
25 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
26 | import org.apache.felix.scr.annotations.Service; | 28 | import org.apache.felix.scr.annotations.Service; |
29 | +import org.onlab.metrics.MetricsService; | ||
30 | +import org.onlab.onos.core.MetricsHelper; | ||
27 | import org.onlab.onos.net.intent.Intent; | 31 | import org.onlab.onos.net.intent.Intent; |
28 | import org.onlab.onos.net.intent.IntentEvent; | 32 | import org.onlab.onos.net.intent.IntentEvent; |
29 | import org.onlab.onos.net.intent.IntentId; | 33 | import org.onlab.onos.net.intent.IntentId; |
... | @@ -48,12 +52,13 @@ import java.util.concurrent.ConcurrentHashMap; | ... | @@ -48,12 +52,13 @@ import java.util.concurrent.ConcurrentHashMap; |
48 | 52 | ||
49 | import static org.onlab.onos.net.intent.IntentState.*; | 53 | import static org.onlab.onos.net.intent.IntentState.*; |
50 | import static org.slf4j.LoggerFactory.getLogger; | 54 | import static org.slf4j.LoggerFactory.getLogger; |
55 | +import static org.onlab.metrics.MetricsUtil.*; | ||
51 | 56 | ||
52 | @Component(immediate = true, enabled = true) | 57 | @Component(immediate = true, enabled = true) |
53 | @Service | 58 | @Service |
54 | public class DistributedIntentStore | 59 | public class DistributedIntentStore |
55 | extends AbstractStore<IntentEvent, IntentStoreDelegate> | 60 | extends AbstractStore<IntentEvent, IntentStoreDelegate> |
56 | - implements IntentStore { | 61 | + implements IntentStore, MetricsHelper { |
57 | 62 | ||
58 | /** Valid parking state, which can transition to INSTALLED. */ | 63 | /** Valid parking state, which can transition to INSTALLED. */ |
59 | private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); | 64 | private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); |
... | @@ -81,11 +86,41 @@ public class DistributedIntentStore | ... | @@ -81,11 +86,41 @@ public class DistributedIntentStore |
81 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 86 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
82 | protected DatabaseService dbService; | 87 | protected DatabaseService dbService; |
83 | 88 | ||
89 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
90 | + protected MetricsService metricsService; | ||
91 | + | ||
84 | // TODO make this configurable | 92 | // TODO make this configurable |
85 | private boolean onlyLogTransitionError = true; | 93 | private boolean onlyLogTransitionError = true; |
86 | 94 | ||
95 | + private Timer createIntentTimer; | ||
96 | + private Timer removeIntentTimer; | ||
97 | + private Timer setInstallableIntentsTimer; | ||
98 | + private Timer getInstallableIntentsTimer; | ||
99 | + private Timer removeInstalledIntentsTimer; | ||
100 | + private Timer setStateTimer; | ||
101 | + private Timer getIntentCountTimer; | ||
102 | + private Timer getIntentsTimer; | ||
103 | + private Timer getIntentTimer; | ||
104 | + private Timer getIntentStateTimer; | ||
105 | + | ||
106 | + | ||
107 | + private Timer createResponseTimer(String methodName) { | ||
108 | + return createTimer("IntentStore", methodName, "responseTime"); | ||
109 | + } | ||
110 | + | ||
87 | @Activate | 111 | @Activate |
88 | public void activate() { | 112 | public void activate() { |
113 | + createIntentTimer = createResponseTimer("createIntent"); | ||
114 | + removeIntentTimer = createResponseTimer("removeIntent"); | ||
115 | + setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); | ||
116 | + getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); | ||
117 | + removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); | ||
118 | + setStateTimer = createResponseTimer("setState"); | ||
119 | + getIntentCountTimer = createResponseTimer("getIntentCount"); | ||
120 | + getIntentsTimer = createResponseTimer("getIntents"); | ||
121 | + getIntentTimer = createResponseTimer("getIntent"); | ||
122 | + getIntentStateTimer = createResponseTimer("getIntentState"); | ||
123 | + | ||
89 | // FIXME: We need a way to add serializer for intents which has been plugged-in. | 124 | // FIXME: We need a way to add serializer for intents which has been plugged-in. |
90 | // As a short term workaround, relax Kryo config to | 125 | // As a short term workaround, relax Kryo config to |
91 | // registrationRequired=false | 126 | // registrationRequired=false |
... | @@ -118,7 +153,14 @@ public class DistributedIntentStore | ... | @@ -118,7 +153,14 @@ public class DistributedIntentStore |
118 | } | 153 | } |
119 | 154 | ||
120 | @Override | 155 | @Override |
156 | + public MetricsService metricsService() { | ||
157 | + return metricsService; | ||
158 | + } | ||
159 | + | ||
160 | + @Override | ||
121 | public IntentEvent createIntent(Intent intent) { | 161 | public IntentEvent createIntent(Intent intent) { |
162 | + Context timer = startTimer(createIntentTimer); | ||
163 | + try { | ||
122 | boolean absent = intents.putIfAbsent(intent.id(), intent); | 164 | boolean absent = intents.putIfAbsent(intent.id(), intent); |
123 | if (!absent) { | 165 | if (!absent) { |
124 | // duplicate, ignore | 166 | // duplicate, ignore |
... | @@ -126,10 +168,15 @@ public class DistributedIntentStore | ... | @@ -126,10 +168,15 @@ public class DistributedIntentStore |
126 | } else { | 168 | } else { |
127 | return this.setState(intent, IntentState.SUBMITTED); | 169 | return this.setState(intent, IntentState.SUBMITTED); |
128 | } | 170 | } |
171 | + } finally { | ||
172 | + stopTimer(timer); | ||
173 | + } | ||
129 | } | 174 | } |
130 | 175 | ||
131 | @Override | 176 | @Override |
132 | public IntentEvent removeIntent(IntentId intentId) { | 177 | public IntentEvent removeIntent(IntentId intentId) { |
178 | + Context timer = startTimer(removeIntentTimer); | ||
179 | + try { | ||
133 | Intent intent = intents.remove(intentId); | 180 | Intent intent = intents.remove(intentId); |
134 | installable.remove(intentId); | 181 | installable.remove(intentId); |
135 | if (intent == null) { | 182 | if (intent == null) { |
... | @@ -141,32 +188,56 @@ public class DistributedIntentStore | ... | @@ -141,32 +188,56 @@ public class DistributedIntentStore |
141 | transientStates.remove(intentId); | 188 | transientStates.remove(intentId); |
142 | // TODO: Should we callremoveInstalledIntents if this Intent was | 189 | // TODO: Should we callremoveInstalledIntents if this Intent was |
143 | return event; | 190 | return event; |
191 | + } finally { | ||
192 | + stopTimer(timer); | ||
193 | + } | ||
144 | } | 194 | } |
145 | 195 | ||
146 | @Override | 196 | @Override |
147 | public long getIntentCount() { | 197 | public long getIntentCount() { |
198 | + Context timer = startTimer(getIntentCountTimer); | ||
199 | + try { | ||
148 | return intents.size(); | 200 | return intents.size(); |
201 | + } finally { | ||
202 | + stopTimer(timer); | ||
203 | + } | ||
149 | } | 204 | } |
150 | 205 | ||
151 | @Override | 206 | @Override |
152 | public Iterable<Intent> getIntents() { | 207 | public Iterable<Intent> getIntents() { |
208 | + Context timer = startTimer(getIntentsTimer); | ||
209 | + try { | ||
153 | return ImmutableSet.copyOf(intents.values()); | 210 | return ImmutableSet.copyOf(intents.values()); |
211 | + } finally { | ||
212 | + stopTimer(timer); | ||
213 | + } | ||
154 | } | 214 | } |
155 | 215 | ||
156 | @Override | 216 | @Override |
157 | public Intent getIntent(IntentId intentId) { | 217 | public Intent getIntent(IntentId intentId) { |
218 | + Context timer = startTimer(getIntentTimer); | ||
219 | + try { | ||
158 | return intents.get(intentId); | 220 | return intents.get(intentId); |
221 | + } finally { | ||
222 | + stopTimer(timer); | ||
223 | + } | ||
159 | } | 224 | } |
160 | 225 | ||
161 | @Override | 226 | @Override |
162 | public IntentState getIntentState(IntentId id) { | 227 | public IntentState getIntentState(IntentId id) { |
228 | + Context timer = startTimer(getIntentStateTimer); | ||
229 | + try { | ||
163 | final IntentState localState = transientStates.get(id); | 230 | final IntentState localState = transientStates.get(id); |
164 | if (localState != null) { | 231 | if (localState != null) { |
165 | return localState; | 232 | return localState; |
166 | } | 233 | } |
167 | return states.get(id); | 234 | return states.get(id); |
235 | + } finally { | ||
236 | + stopTimer(timer); | ||
237 | + } | ||
168 | } | 238 | } |
169 | 239 | ||
240 | + // FIXME temporary workaround until we fix our state machine | ||
170 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | 241 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { |
171 | if (onlyLogTransitionError) { | 242 | if (onlyLogTransitionError) { |
172 | if (!expression) { | 243 | if (!expression) { |
... | @@ -179,6 +250,8 @@ public class DistributedIntentStore | ... | @@ -179,6 +250,8 @@ public class DistributedIntentStore |
179 | 250 | ||
180 | @Override | 251 | @Override |
181 | public IntentEvent setState(Intent intent, IntentState state) { | 252 | public IntentEvent setState(Intent intent, IntentState state) { |
253 | + Context timer = startTimer(setStateTimer); | ||
254 | + try { | ||
182 | final IntentId id = intent.id(); | 255 | final IntentId id = intent.id(); |
183 | IntentEvent.Type evtType = null; | 256 | IntentEvent.Type evtType = null; |
184 | final IntentState prevParking; | 257 | final IntentState prevParking; |
... | @@ -248,20 +321,38 @@ public class DistributedIntentStore | ... | @@ -248,20 +321,38 @@ public class DistributedIntentStore |
248 | return null; | 321 | return null; |
249 | } | 322 | } |
250 | return new IntentEvent(evtType, intent); | 323 | return new IntentEvent(evtType, intent); |
324 | + } finally { | ||
325 | + stopTimer(timer); | ||
326 | + } | ||
251 | } | 327 | } |
252 | 328 | ||
253 | @Override | 329 | @Override |
254 | public void setInstallableIntents(IntentId intentId, List<Intent> result) { | 330 | public void setInstallableIntents(IntentId intentId, List<Intent> result) { |
331 | + Context timer = startTimer(setInstallableIntentsTimer); | ||
332 | + try { | ||
255 | installable.put(intentId, result); | 333 | installable.put(intentId, result); |
334 | + } finally { | ||
335 | + stopTimer(timer); | ||
336 | + } | ||
256 | } | 337 | } |
257 | 338 | ||
258 | @Override | 339 | @Override |
259 | public List<Intent> getInstallableIntents(IntentId intentId) { | 340 | public List<Intent> getInstallableIntents(IntentId intentId) { |
341 | + Context timer = startTimer(getInstallableIntentsTimer); | ||
342 | + try { | ||
260 | return installable.get(intentId); | 343 | return installable.get(intentId); |
344 | + } finally { | ||
345 | + stopTimer(timer); | ||
346 | + } | ||
261 | } | 347 | } |
262 | 348 | ||
263 | @Override | 349 | @Override |
264 | public void removeInstalledIntents(IntentId intentId) { | 350 | public void removeInstalledIntents(IntentId intentId) { |
351 | + Context timer = startTimer(removeInstalledIntentsTimer); | ||
352 | + try { | ||
265 | installable.remove(intentId); | 353 | installable.remove(intentId); |
354 | + } finally { | ||
355 | + stopTimer(timer); | ||
356 | + } | ||
266 | } | 357 | } |
267 | } | 358 | } | ... | ... |
... | @@ -15,6 +15,8 @@ | ... | @@ -15,6 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onlab.onos.store.intent.impl; | 16 | package org.onlab.onos.store.intent.impl; |
17 | 17 | ||
18 | +import com.codahale.metrics.Timer; | ||
19 | +import com.codahale.metrics.Timer.Context; | ||
18 | import com.google.common.base.Verify; | 20 | import com.google.common.base.Verify; |
19 | import com.google.common.collect.ImmutableSet; | 21 | import com.google.common.collect.ImmutableSet; |
20 | import com.hazelcast.core.EntryAdapter; | 22 | import com.hazelcast.core.EntryAdapter; |
... | @@ -26,7 +28,11 @@ import com.hazelcast.core.Member; | ... | @@ -26,7 +28,11 @@ import com.hazelcast.core.Member; |
26 | import org.apache.felix.scr.annotations.Activate; | 28 | import org.apache.felix.scr.annotations.Activate; |
27 | import org.apache.felix.scr.annotations.Component; | 29 | import org.apache.felix.scr.annotations.Component; |
28 | import org.apache.felix.scr.annotations.Deactivate; | 30 | import org.apache.felix.scr.annotations.Deactivate; |
31 | +import org.apache.felix.scr.annotations.Reference; | ||
32 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
29 | import org.apache.felix.scr.annotations.Service; | 33 | import org.apache.felix.scr.annotations.Service; |
34 | +import org.onlab.metrics.MetricsService; | ||
35 | +import org.onlab.onos.core.MetricsHelper; | ||
30 | import org.onlab.onos.net.intent.Intent; | 36 | import org.onlab.onos.net.intent.Intent; |
31 | import org.onlab.onos.net.intent.IntentEvent; | 37 | import org.onlab.onos.net.intent.IntentEvent; |
32 | import org.onlab.onos.net.intent.IntentId; | 38 | import org.onlab.onos.net.intent.IntentId; |
... | @@ -48,12 +54,13 @@ import java.util.concurrent.ConcurrentHashMap; | ... | @@ -48,12 +54,13 @@ import java.util.concurrent.ConcurrentHashMap; |
48 | 54 | ||
49 | import static org.onlab.onos.net.intent.IntentState.*; | 55 | import static org.onlab.onos.net.intent.IntentState.*; |
50 | import static org.slf4j.LoggerFactory.getLogger; | 56 | import static org.slf4j.LoggerFactory.getLogger; |
57 | +import static org.onlab.metrics.MetricsUtil.*; | ||
51 | 58 | ||
52 | @Component(immediate = true, enabled = false) | 59 | @Component(immediate = true, enabled = false) |
53 | @Service | 60 | @Service |
54 | public class HazelcastIntentStore | 61 | public class HazelcastIntentStore |
55 | extends AbstractHazelcastStore<IntentEvent, IntentStoreDelegate> | 62 | extends AbstractHazelcastStore<IntentEvent, IntentStoreDelegate> |
56 | - implements IntentStore { | 63 | + implements IntentStore, MetricsHelper { |
57 | 64 | ||
58 | /** Valid parking state, which can transition to INSTALLED. */ | 65 | /** Valid parking state, which can transition to INSTALLED. */ |
59 | private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); | 66 | private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(SUBMITTED, INSTALLED, FAILED); |
... | @@ -72,12 +79,41 @@ public class HazelcastIntentStore | ... | @@ -72,12 +79,41 @@ public class HazelcastIntentStore |
72 | 79 | ||
73 | private SMap<IntentId, List<Intent>> installable; | 80 | private SMap<IntentId, List<Intent>> installable; |
74 | 81 | ||
82 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
83 | + protected MetricsService metricsService; | ||
84 | + | ||
75 | // TODO make this configurable | 85 | // TODO make this configurable |
76 | private boolean onlyLogTransitionError = true; | 86 | private boolean onlyLogTransitionError = true; |
77 | 87 | ||
88 | + private Timer createIntentTimer; | ||
89 | + private Timer removeIntentTimer; | ||
90 | + private Timer setInstallableIntentsTimer; | ||
91 | + private Timer getInstallableIntentsTimer; | ||
92 | + private Timer removeInstalledIntentsTimer; | ||
93 | + private Timer setStateTimer; | ||
94 | + private Timer getIntentCountTimer; | ||
95 | + private Timer getIntentsTimer; | ||
96 | + private Timer getIntentTimer; | ||
97 | + private Timer getIntentStateTimer; | ||
98 | + | ||
99 | + private Timer createResponseTimer(String methodName) { | ||
100 | + return createTimer("IntentStore", methodName, "responseTime"); | ||
101 | + } | ||
102 | + | ||
78 | @Override | 103 | @Override |
79 | @Activate | 104 | @Activate |
80 | public void activate() { | 105 | public void activate() { |
106 | + createIntentTimer = createResponseTimer("createIntent"); | ||
107 | + removeIntentTimer = createResponseTimer("removeIntent"); | ||
108 | + setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); | ||
109 | + getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); | ||
110 | + removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); | ||
111 | + setStateTimer = createResponseTimer("setState"); | ||
112 | + getIntentCountTimer = createResponseTimer("getIntentCount"); | ||
113 | + getIntentsTimer = createResponseTimer("getIntents"); | ||
114 | + getIntentTimer = createResponseTimer("getIntent"); | ||
115 | + getIntentStateTimer = createResponseTimer("getIntentState"); | ||
116 | + | ||
81 | // FIXME: We need a way to add serializer for intents which has been plugged-in. | 117 | // FIXME: We need a way to add serializer for intents which has been plugged-in. |
82 | // As a short term workaround, relax Kryo config to | 118 | // As a short term workaround, relax Kryo config to |
83 | // registrationRequired=false | 119 | // registrationRequired=false |
... | @@ -120,7 +156,14 @@ public class HazelcastIntentStore | ... | @@ -120,7 +156,14 @@ public class HazelcastIntentStore |
120 | } | 156 | } |
121 | 157 | ||
122 | @Override | 158 | @Override |
159 | + public MetricsService metricsService() { | ||
160 | + return metricsService; | ||
161 | + } | ||
162 | + | ||
163 | + @Override | ||
123 | public IntentEvent createIntent(Intent intent) { | 164 | public IntentEvent createIntent(Intent intent) { |
165 | + Context timer = startTimer(createIntentTimer); | ||
166 | + try { | ||
124 | Intent existing = intents.putIfAbsent(intent.id(), intent); | 167 | Intent existing = intents.putIfAbsent(intent.id(), intent); |
125 | if (existing != null) { | 168 | if (existing != null) { |
126 | // duplicate, ignore | 169 | // duplicate, ignore |
... | @@ -128,10 +171,15 @@ public class HazelcastIntentStore | ... | @@ -128,10 +171,15 @@ public class HazelcastIntentStore |
128 | } else { | 171 | } else { |
129 | return this.setState(intent, IntentState.SUBMITTED); | 172 | return this.setState(intent, IntentState.SUBMITTED); |
130 | } | 173 | } |
174 | + } finally { | ||
175 | + stopTimer(timer); | ||
176 | + } | ||
131 | } | 177 | } |
132 | 178 | ||
133 | @Override | 179 | @Override |
134 | public IntentEvent removeIntent(IntentId intentId) { | 180 | public IntentEvent removeIntent(IntentId intentId) { |
181 | + Context timer = startTimer(removeIntentTimer); | ||
182 | + try { | ||
135 | Intent intent = intents.remove(intentId); | 183 | Intent intent = intents.remove(intentId); |
136 | installable.remove(intentId); | 184 | installable.remove(intentId); |
137 | if (intent == null) { | 185 | if (intent == null) { |
... | @@ -143,30 +191,53 @@ public class HazelcastIntentStore | ... | @@ -143,30 +191,53 @@ public class HazelcastIntentStore |
143 | transientStates.remove(intentId); | 191 | transientStates.remove(intentId); |
144 | // TODO: Should we callremoveInstalledIntents if this Intent was | 192 | // TODO: Should we callremoveInstalledIntents if this Intent was |
145 | return event; | 193 | return event; |
194 | + } finally { | ||
195 | + stopTimer(timer); | ||
196 | + } | ||
146 | } | 197 | } |
147 | 198 | ||
148 | @Override | 199 | @Override |
149 | public long getIntentCount() { | 200 | public long getIntentCount() { |
201 | + Context timer = startTimer(getIntentCountTimer); | ||
202 | + try { | ||
150 | return intents.size(); | 203 | return intents.size(); |
204 | + } finally { | ||
205 | + stopTimer(timer); | ||
206 | + } | ||
151 | } | 207 | } |
152 | 208 | ||
153 | @Override | 209 | @Override |
154 | public Iterable<Intent> getIntents() { | 210 | public Iterable<Intent> getIntents() { |
211 | + Context timer = startTimer(getIntentsTimer); | ||
212 | + try { | ||
155 | return ImmutableSet.copyOf(intents.values()); | 213 | return ImmutableSet.copyOf(intents.values()); |
214 | + } finally { | ||
215 | + stopTimer(timer); | ||
216 | + } | ||
156 | } | 217 | } |
157 | 218 | ||
158 | @Override | 219 | @Override |
159 | public Intent getIntent(IntentId intentId) { | 220 | public Intent getIntent(IntentId intentId) { |
221 | + Context timer = startTimer(getIntentTimer); | ||
222 | + try { | ||
160 | return intents.get(intentId); | 223 | return intents.get(intentId); |
224 | + } finally { | ||
225 | + stopTimer(timer); | ||
226 | + } | ||
161 | } | 227 | } |
162 | 228 | ||
163 | @Override | 229 | @Override |
164 | public IntentState getIntentState(IntentId id) { | 230 | public IntentState getIntentState(IntentId id) { |
231 | + Context timer = startTimer(getIntentStateTimer); | ||
232 | + try { | ||
165 | final IntentState localState = transientStates.get(id); | 233 | final IntentState localState = transientStates.get(id); |
166 | if (localState != null) { | 234 | if (localState != null) { |
167 | return localState; | 235 | return localState; |
168 | } | 236 | } |
169 | return states.get(id); | 237 | return states.get(id); |
238 | + } finally { | ||
239 | + stopTimer(timer); | ||
240 | + } | ||
170 | } | 241 | } |
171 | 242 | ||
172 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | 243 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { |
... | @@ -181,6 +252,9 @@ public class HazelcastIntentStore | ... | @@ -181,6 +252,9 @@ public class HazelcastIntentStore |
181 | 252 | ||
182 | @Override | 253 | @Override |
183 | public IntentEvent setState(Intent intent, IntentState state) { | 254 | public IntentEvent setState(Intent intent, IntentState state) { |
255 | + Context timer = startTimer(setStateTimer); | ||
256 | + try { | ||
257 | + | ||
184 | final IntentId id = intent.id(); | 258 | final IntentId id = intent.id(); |
185 | IntentEvent.Type type = null; | 259 | IntentEvent.Type type = null; |
186 | final IntentState prevParking; | 260 | final IntentState prevParking; |
... | @@ -236,21 +310,39 @@ public class HazelcastIntentStore | ... | @@ -236,21 +310,39 @@ public class HazelcastIntentStore |
236 | return null; | 310 | return null; |
237 | } | 311 | } |
238 | return new IntentEvent(type, intent); | 312 | return new IntentEvent(type, intent); |
313 | + } finally { | ||
314 | + stopTimer(timer); | ||
315 | + } | ||
239 | } | 316 | } |
240 | 317 | ||
241 | @Override | 318 | @Override |
242 | public void setInstallableIntents(IntentId intentId, List<Intent> result) { | 319 | public void setInstallableIntents(IntentId intentId, List<Intent> result) { |
320 | + Context timer = startTimer(setInstallableIntentsTimer); | ||
321 | + try { | ||
243 | installable.put(intentId, result); | 322 | installable.put(intentId, result); |
323 | + } finally { | ||
324 | + stopTimer(timer); | ||
325 | + } | ||
244 | } | 326 | } |
245 | 327 | ||
246 | @Override | 328 | @Override |
247 | public List<Intent> getInstallableIntents(IntentId intentId) { | 329 | public List<Intent> getInstallableIntents(IntentId intentId) { |
330 | + Context timer = startTimer(getInstallableIntentsTimer); | ||
331 | + try { | ||
248 | return installable.get(intentId); | 332 | return installable.get(intentId); |
333 | + } finally { | ||
334 | + stopTimer(timer); | ||
335 | + } | ||
249 | } | 336 | } |
250 | 337 | ||
251 | @Override | 338 | @Override |
252 | public void removeInstalledIntents(IntentId intentId) { | 339 | public void removeInstalledIntents(IntentId intentId) { |
340 | + Context timer = startTimer(removeInstalledIntentsTimer); | ||
341 | + try { | ||
253 | installable.remove(intentId); | 342 | installable.remove(intentId); |
343 | + } finally { | ||
344 | + stopTimer(timer); | ||
345 | + } | ||
254 | } | 346 | } |
255 | 347 | ||
256 | public final class RemoteIntentStateListener extends EntryAdapter<IntentId, IntentState> { | 348 | public final class RemoteIntentStateListener extends EntryAdapter<IntentId, IntentState> { | ... | ... |
-
Please register or login to post a comment