Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.store.intent.impl; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 17 | |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 18 | import com.codahale.metrics.Timer; |
| 19 | import com.codahale.metrics.Timer.Context; |
Yuta HIGUCHI | c8f3026 | 2014-11-20 19:14:42 -0800 | [diff] [blame] | 20 | import com.google.common.base.Verify; |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 21 | import com.google.common.collect.ImmutableList; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 22 | import com.google.common.collect.ImmutableSet; |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 23 | import com.google.common.collect.Lists; |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 24 | import com.hazelcast.config.Config; |
| 25 | import com.hazelcast.config.MapConfig; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 26 | import com.hazelcast.core.EntryAdapter; |
| 27 | import com.hazelcast.core.EntryEvent; |
| 28 | import com.hazelcast.core.EntryListener; |
| 29 | import com.hazelcast.core.IMap; |
| 30 | import com.hazelcast.core.Member; |
| 31 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 32 | import org.apache.commons.lang3.tuple.Pair; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 33 | import org.apache.felix.scr.annotations.Activate; |
| 34 | import org.apache.felix.scr.annotations.Component; |
| 35 | import org.apache.felix.scr.annotations.Deactivate; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 36 | import org.apache.felix.scr.annotations.Reference; |
| 37 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 38 | import org.apache.felix.scr.annotations.Service; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 39 | import org.onlab.metrics.MetricsService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 40 | import org.onosproject.core.MetricsHelper; |
Sho SHIMIZU | 64ae11c | 2014-12-03 15:17:47 -0800 | [diff] [blame] | 41 | import org.onosproject.net.intent.BatchWrite; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 42 | import org.onosproject.net.intent.Intent; |
| 43 | import org.onosproject.net.intent.IntentEvent; |
| 44 | import org.onosproject.net.intent.IntentId; |
| 45 | import org.onosproject.net.intent.IntentState; |
| 46 | import org.onosproject.net.intent.IntentStore; |
Sho SHIMIZU | 64ae11c | 2014-12-03 15:17:47 -0800 | [diff] [blame] | 47 | import org.onosproject.net.intent.BatchWrite.Operation; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 48 | import org.onosproject.net.intent.IntentStoreDelegate; |
| 49 | import org.onosproject.store.hz.AbstractHazelcastStore; |
| 50 | import org.onosproject.store.hz.SMap; |
| 51 | import org.onosproject.store.serializers.KryoNamespaces; |
| 52 | import org.onosproject.store.serializers.KryoSerializer; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 53 | import org.onlab.util.KryoNamespace; |
| 54 | import org.slf4j.Logger; |
| 55 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 56 | import java.util.ArrayList; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 57 | import java.util.EnumSet; |
| 58 | import java.util.List; |
| 59 | import java.util.Map; |
| 60 | import java.util.Set; |
| 61 | import java.util.concurrent.ConcurrentHashMap; |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 62 | import java.util.concurrent.ExecutionException; |
| 63 | import java.util.concurrent.Future; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 64 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 65 | import static com.google.common.base.Preconditions.checkArgument; |
Thomas Vachuska | e4b6bb2 | 2014-11-25 17:09:43 -0800 | [diff] [blame] | 66 | import static com.google.common.base.Preconditions.checkState; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 67 | import static org.onosproject.net.intent.IntentState.*; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 68 | import static org.slf4j.LoggerFactory.getLogger; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 69 | import static org.onlab.metrics.MetricsUtil.*; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 70 | |
Yuta HIGUCHI | 9b108b3 | 2014-12-01 11:10:26 -0800 | [diff] [blame] | 71 | @Component(immediate = true, enabled = true) |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 72 | @Service |
| 73 | public class HazelcastIntentStore |
| 74 | extends AbstractHazelcastStore<IntentEvent, IntentStoreDelegate> |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 75 | implements IntentStore, MetricsHelper { |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 76 | |
| 77 | /** Valid parking state, which can transition to INSTALLED. */ |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 78 | private static final Set<IntentState> PRE_INSTALLED = EnumSet.of(INSTALL_REQ, INSTALLED, FAILED); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 79 | |
| 80 | /** Valid parking state, which can transition to WITHDRAWN. */ |
| 81 | private static final Set<IntentState> PRE_WITHDRAWN = EnumSet.of(INSTALLED, FAILED); |
| 82 | |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 83 | private static final Set<IntentState> PARKING = EnumSet.of(INSTALL_REQ, INSTALLED, WITHDRAWN, FAILED); |
Yuta HIGUCHI | f568245 | 2014-12-01 10:17:15 -0800 | [diff] [blame] | 84 | |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 85 | private final Logger log = getLogger(getClass()); |
| 86 | |
| 87 | // Assumption: IntentId will not have synonyms |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 88 | private static final String INTENTS_MAP_NAME = "intents"; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 89 | private SMap<IntentId, Intent> intents; |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 90 | private static final String INTENT_STATES_MAP_NAME = "intent-states"; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 91 | private SMap<IntentId, IntentState> states; |
| 92 | |
| 93 | // Map to store instance local intermediate state transition |
| 94 | private transient Map<IntentId, IntentState> transientStates = new ConcurrentHashMap<>(); |
| 95 | |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 96 | private static final String INSTALLABLE_INTENTS_MAP_NAME = "installable-intents"; |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 97 | private SMap<IntentId, List<Intent>> installable; |
| 98 | |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 99 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 100 | protected MetricsService metricsService; |
| 101 | |
Yuta HIGUCHI | c8f3026 | 2014-11-20 19:14:42 -0800 | [diff] [blame] | 102 | // TODO make this configurable |
| 103 | private boolean onlyLogTransitionError = true; |
| 104 | |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 105 | private Timer createIntentTimer; |
| 106 | private Timer removeIntentTimer; |
| 107 | private Timer setInstallableIntentsTimer; |
| 108 | private Timer getInstallableIntentsTimer; |
| 109 | private Timer removeInstalledIntentsTimer; |
| 110 | private Timer setStateTimer; |
| 111 | private Timer getIntentCountTimer; |
| 112 | private Timer getIntentsTimer; |
| 113 | private Timer getIntentTimer; |
| 114 | private Timer getIntentStateTimer; |
| 115 | |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 116 | // manual near cache of Intent |
| 117 | // (Note: IntentId -> Intent is expected to be immutable) |
| 118 | // entry will be evicted, when state for that IntentId is removed. |
| 119 | private Map<IntentId, Intent> localIntents; |
| 120 | |
| 121 | private String stateListenerId; |
| 122 | |
| 123 | private String intentsListenerId; |
Yuta HIGUCHI | d1a63e9 | 2014-12-02 13:14:28 -0800 | [diff] [blame] | 124 | |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 125 | private Timer createResponseTimer(String methodName) { |
| 126 | return createTimer("IntentStore", methodName, "responseTime"); |
| 127 | } |
| 128 | |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 129 | @Override |
| 130 | @Activate |
| 131 | public void activate() { |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 132 | localIntents = new ConcurrentHashMap<>(); |
| 133 | |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 134 | createIntentTimer = createResponseTimer("createIntent"); |
| 135 | removeIntentTimer = createResponseTimer("removeIntent"); |
| 136 | setInstallableIntentsTimer = createResponseTimer("setInstallableIntents"); |
| 137 | getInstallableIntentsTimer = createResponseTimer("getInstallableIntents"); |
| 138 | removeInstalledIntentsTimer = createResponseTimer("removeInstalledIntents"); |
| 139 | setStateTimer = createResponseTimer("setState"); |
| 140 | getIntentCountTimer = createResponseTimer("getIntentCount"); |
| 141 | getIntentsTimer = createResponseTimer("getIntents"); |
| 142 | getIntentTimer = createResponseTimer("getIntent"); |
| 143 | getIntentStateTimer = createResponseTimer("getIntentState"); |
| 144 | |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 145 | // FIXME: We need a way to add serializer for intents which has been plugged-in. |
| 146 | // As a short term workaround, relax Kryo config to |
| 147 | // registrationRequired=false |
| 148 | super.activate(); |
| 149 | super.serializer = new KryoSerializer() { |
| 150 | |
| 151 | @Override |
| 152 | protected void setupKryoPool() { |
| 153 | serializerPool = KryoNamespace.newBuilder() |
| 154 | .setRegistrationRequired(false) |
| 155 | .register(KryoNamespaces.API) |
Yuta HIGUCHI | 91768e3 | 2014-11-22 05:06:35 -0800 | [diff] [blame] | 156 | .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID) |
| 157 | .build(); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | }; |
| 161 | |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 162 | final Config config = theInstance.getConfig(); |
| 163 | |
| 164 | MapConfig intentsCfg = config.getMapConfig(INTENTS_MAP_NAME); |
| 165 | intentsCfg.setAsyncBackupCount(MapConfig.MAX_BACKUP_COUNT - intentsCfg.getBackupCount()); |
| 166 | |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 167 | // TODO: enable near cache, allow read from backup for this IMap |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 168 | IMap<byte[], byte[]> rawIntents = super.theInstance.getMap(INTENTS_MAP_NAME); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 169 | intents = new SMap<>(rawIntents , super.serializer); |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 170 | intentsListenerId = intents.addEntryListener(new RemoteIntentsListener(), true); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 171 | |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 172 | MapConfig statesCfg = config.getMapConfig(INTENT_STATES_MAP_NAME); |
| 173 | statesCfg.setAsyncBackupCount(MapConfig.MAX_BACKUP_COUNT - statesCfg.getBackupCount()); |
| 174 | |
| 175 | IMap<byte[], byte[]> rawStates = super.theInstance.getMap(INTENT_STATES_MAP_NAME); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 176 | states = new SMap<>(rawStates , super.serializer); |
| 177 | EntryListener<IntentId, IntentState> listener = new RemoteIntentStateListener(); |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 178 | stateListenerId = states.addEntryListener(listener, true); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 179 | |
| 180 | transientStates.clear(); |
| 181 | |
Yuta HIGUCHI | d36a58e | 2014-12-02 12:46:33 -0800 | [diff] [blame] | 182 | MapConfig installableCfg = config.getMapConfig(INSTALLABLE_INTENTS_MAP_NAME); |
| 183 | installableCfg.setAsyncBackupCount(MapConfig.MAX_BACKUP_COUNT - installableCfg.getBackupCount()); |
| 184 | |
| 185 | IMap<byte[], byte[]> rawInstallables = super.theInstance.getMap(INSTALLABLE_INTENTS_MAP_NAME); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 186 | installable = new SMap<>(rawInstallables , super.serializer); |
| 187 | |
| 188 | log.info("Started"); |
| 189 | } |
| 190 | |
| 191 | @Deactivate |
| 192 | public void deactivate() { |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 193 | intents.removeEntryListener(intentsListenerId); |
| 194 | states.removeEntryListener(stateListenerId); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 195 | log.info("Stopped"); |
| 196 | } |
| 197 | |
| 198 | @Override |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 199 | public MetricsService metricsService() { |
| 200 | return metricsService; |
| 201 | } |
| 202 | |
| 203 | @Override |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 204 | public void createIntent(Intent intent) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 205 | Context timer = startTimer(createIntentTimer); |
| 206 | try { |
| 207 | Intent existing = intents.putIfAbsent(intent.id(), intent); |
| 208 | if (existing != null) { |
| 209 | // duplicate, ignore |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 210 | return; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 211 | } else { |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 212 | this.setState(intent, IntentState.INSTALL_REQ); |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 213 | return; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 214 | } |
| 215 | } finally { |
| 216 | stopTimer(timer); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 217 | } |
| 218 | } |
| 219 | |
| 220 | @Override |
Thomas Vachuska | e4b6bb2 | 2014-11-25 17:09:43 -0800 | [diff] [blame] | 221 | public void removeIntent(IntentId intentId) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 222 | Context timer = startTimer(removeIntentTimer); |
Thomas Vachuska | e4b6bb2 | 2014-11-25 17:09:43 -0800 | [diff] [blame] | 223 | checkState(getIntentState(intentId) == WITHDRAWN, |
| 224 | "Intent state for {} is not WITHDRAWN.", intentId); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 225 | try { |
Thomas Vachuska | e4b6bb2 | 2014-11-25 17:09:43 -0800 | [diff] [blame] | 226 | intents.remove(intentId); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 227 | installable.remove(intentId); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 228 | states.remove(intentId); |
| 229 | transientStates.remove(intentId); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 230 | } finally { |
| 231 | stopTimer(timer); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 232 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | @Override |
| 236 | public long getIntentCount() { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 237 | Context timer = startTimer(getIntentCountTimer); |
| 238 | try { |
| 239 | return intents.size(); |
| 240 | } finally { |
| 241 | stopTimer(timer); |
| 242 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | @Override |
| 246 | public Iterable<Intent> getIntents() { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 247 | Context timer = startTimer(getIntentsTimer); |
| 248 | try { |
| 249 | return ImmutableSet.copyOf(intents.values()); |
| 250 | } finally { |
| 251 | stopTimer(timer); |
| 252 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | @Override |
| 256 | public Intent getIntent(IntentId intentId) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 257 | Context timer = startTimer(getIntentTimer); |
| 258 | try { |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 259 | Intent intent = localIntents.get(intentId); |
| 260 | if (intent != null) { |
| 261 | return intent; |
| 262 | } |
| 263 | intent = intents.get(intentId); |
| 264 | if (intent != null) { |
| 265 | localIntents.put(intentId, intent); |
| 266 | } |
| 267 | return intent; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 268 | } finally { |
| 269 | stopTimer(timer); |
| 270 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | @Override |
| 274 | public IntentState getIntentState(IntentId id) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 275 | Context timer = startTimer(getIntentStateTimer); |
| 276 | try { |
| 277 | final IntentState localState = transientStates.get(id); |
| 278 | if (localState != null) { |
| 279 | return localState; |
| 280 | } |
| 281 | return states.get(id); |
| 282 | } finally { |
| 283 | stopTimer(timer); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 284 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 285 | } |
| 286 | |
Yuta HIGUCHI | c8f3026 | 2014-11-20 19:14:42 -0800 | [diff] [blame] | 287 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { |
| 288 | if (onlyLogTransitionError) { |
| 289 | if (!expression) { |
| 290 | log.error(errorMessageTemplate.replace("%s", "{}"), errorMessageArgs); |
| 291 | } |
| 292 | } else { |
| 293 | Verify.verify(expression, errorMessageTemplate, errorMessageArgs); |
| 294 | } |
| 295 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 296 | |
| 297 | @Override |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 298 | public void setState(Intent intent, IntentState state) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 299 | Context timer = startTimer(setStateTimer); |
| 300 | try { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 301 | final IntentId id = intent.id(); |
| 302 | IntentEvent.Type type = null; |
| 303 | final IntentState prevParking; |
| 304 | boolean transientStateChangeOnly = false; |
| 305 | |
| 306 | // parking state transition |
| 307 | switch (state) { |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 308 | case INSTALL_REQ: |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 309 | prevParking = states.get(id); |
| 310 | if (prevParking == null) { |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 311 | IntentState existing = states.putIfAbsent(id, INSTALL_REQ); |
| 312 | verify(existing == null, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 313 | } else { |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 314 | verify(PRE_INSTALLED.contains(prevParking), |
| 315 | "Illegal state transition attempted from %s to INSTALL_REQ", |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 316 | prevParking); |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 317 | boolean updated = states.replace(id, prevParking, INSTALL_REQ); |
| 318 | verify(updated, "Conditional replace %s => %s failed", prevParking, INSTALL_REQ); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 319 | } |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 320 | type = IntentEvent.Type.INSTALL_REQ; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 321 | break; |
| 322 | case INSTALLED: |
| 323 | prevParking = states.replace(id, INSTALLED); |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 324 | verify(prevParking == INSTALL_REQ, |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 325 | "Illegal state transition attempted from %s to INSTALLED", |
| 326 | prevParking); |
| 327 | type = IntentEvent.Type.INSTALLED; |
| 328 | break; |
| 329 | case FAILED: |
| 330 | prevParking = states.replace(id, FAILED); |
| 331 | type = IntentEvent.Type.FAILED; |
| 332 | break; |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 333 | case WITHDRAW_REQ: |
| 334 | prevParking = states.replace(id, WITHDRAW_REQ); |
| 335 | verify(PRE_WITHDRAWN.contains(prevParking), |
| 336 | "Illegal state transition attempted from %s to WITHDRAW_REQ", |
| 337 | prevParking); |
| 338 | type = IntentEvent.Type.WITHDRAW_REQ; |
| 339 | break; |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 340 | case WITHDRAWN: |
| 341 | prevParking = states.replace(id, WITHDRAWN); |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 342 | verify(prevParking == WITHDRAW_REQ, |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 343 | "Illegal state transition attempted from %s to WITHDRAWN", |
| 344 | prevParking); |
| 345 | type = IntentEvent.Type.WITHDRAWN; |
| 346 | break; |
| 347 | default: |
| 348 | transientStateChangeOnly = true; |
| 349 | prevParking = null; |
| 350 | break; |
Yuta HIGUCHI | 89a7f47 | 2014-11-21 14:50:24 -0800 | [diff] [blame] | 351 | } |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 352 | if (!transientStateChangeOnly) { |
| 353 | log.debug("Parking State change: {} {}=>{}", id, prevParking, state); |
| 354 | } |
| 355 | // Update instance local state, which includes non-parking state transition |
| 356 | final IntentState prevTransient = transientStates.put(id, state); |
| 357 | log.debug("Transient State change: {} {}=>{}", id, prevTransient, state); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 358 | |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 359 | if (type != null) { |
| 360 | notifyDelegate(new IntentEvent(type, intent)); |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 361 | } |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 362 | } finally { |
| 363 | stopTimer(timer); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 364 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | @Override |
| 368 | public void setInstallableIntents(IntentId intentId, List<Intent> result) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 369 | Context timer = startTimer(setInstallableIntentsTimer); |
| 370 | try { |
| 371 | installable.put(intentId, result); |
| 372 | } finally { |
| 373 | stopTimer(timer); |
| 374 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | @Override |
| 378 | public List<Intent> getInstallableIntents(IntentId intentId) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 379 | Context timer = startTimer(getInstallableIntentsTimer); |
| 380 | try { |
| 381 | return installable.get(intentId); |
| 382 | } finally { |
| 383 | stopTimer(timer); |
| 384 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public void removeInstalledIntents(IntentId intentId) { |
Yuta HIGUCHI | e367fb9 | 2014-11-24 22:26:58 -0800 | [diff] [blame] | 389 | Context timer = startTimer(removeInstalledIntentsTimer); |
| 390 | try { |
| 391 | installable.remove(intentId); |
| 392 | } finally { |
| 393 | stopTimer(timer); |
| 394 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 395 | } |
| 396 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 397 | @Override |
| 398 | public List<Operation> batchWrite(BatchWrite batch) { |
| 399 | // Hazelcast version will never fail for conditional failure now. |
| 400 | List<Operation> failed = new ArrayList<>(); |
| 401 | |
| 402 | List<Pair<Operation, List<Future<?>>>> futures = new ArrayList<>(batch.operations().size()); |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 403 | List<IntentEvent> events = Lists.newArrayList(); |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 404 | |
Yuta HIGUCHI | 43772d7 | 2014-12-03 13:57:09 -0800 | [diff] [blame] | 405 | batchWriteAsync(batch, failed, futures); |
| 406 | |
| 407 | // verify result |
| 408 | verifyAsyncWrites(futures, failed, events); |
| 409 | |
| 410 | notifyDelegate(events); |
| 411 | |
| 412 | return failed; |
| 413 | } |
| 414 | |
| 415 | private void batchWriteAsync(BatchWrite batch, List<Operation> failed, |
| 416 | List<Pair<Operation, List<Future<?>>>> futures) { |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 417 | for (Operation op : batch.operations()) { |
| 418 | switch (op.type()) { |
| 419 | case CREATE_INTENT: |
| 420 | checkArgument(op.args().size() == 1, |
| 421 | "CREATE_INTENT takes 1 argument. %s", op); |
| 422 | Intent intent = op.arg(0); |
| 423 | futures.add(Pair.of(op, |
| 424 | ImmutableList.of(intents.putAsync(intent.id(), intent), |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 425 | states.putAsync(intent.id(), INSTALL_REQ)))); |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 426 | break; |
| 427 | |
| 428 | case REMOVE_INTENT: |
| 429 | checkArgument(op.args().size() == 1, |
| 430 | "REMOVE_INTENT takes 1 argument. %s", op); |
| 431 | IntentId intentId = (IntentId) op.arg(0); |
| 432 | futures.add(Pair.of(op, |
| 433 | ImmutableList.of(intents.removeAsync(intentId), |
| 434 | states.removeAsync(intentId), |
| 435 | installable.removeAsync(intentId)))); |
| 436 | break; |
| 437 | |
| 438 | case SET_STATE: |
| 439 | checkArgument(op.args().size() == 2, |
| 440 | "SET_STATE takes 2 arguments. %s", op); |
| 441 | intent = op.arg(0); |
| 442 | IntentState newState = op.arg(1); |
| 443 | futures.add(Pair.of(op, |
| 444 | ImmutableList.of(states.putAsync(intent.id(), newState)))); |
| 445 | break; |
| 446 | |
| 447 | case SET_INSTALLABLE: |
| 448 | checkArgument(op.args().size() == 2, |
| 449 | "SET_INSTALLABLE takes 2 arguments. %s", op); |
| 450 | intentId = op.arg(0); |
| 451 | List<Intent> installableIntents = op.arg(1); |
| 452 | futures.add(Pair.of(op, |
| 453 | ImmutableList.of(installable.putAsync(intentId, installableIntents)))); |
| 454 | break; |
| 455 | |
| 456 | case REMOVE_INSTALLED: |
| 457 | checkArgument(op.args().size() == 1, |
| 458 | "REMOVE_INSTALLED takes 1 argument. %s", op); |
| 459 | intentId = op.arg(0); |
| 460 | futures.add(Pair.of(op, |
| 461 | ImmutableList.of(installable.removeAsync(intentId)))); |
| 462 | break; |
| 463 | |
| 464 | default: |
| 465 | log.warn("Unknown Operation encountered: {}", op); |
| 466 | failed.add(op); |
| 467 | break; |
| 468 | } |
| 469 | } |
Yuta HIGUCHI | 43772d7 | 2014-12-03 13:57:09 -0800 | [diff] [blame] | 470 | } |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 471 | |
Yuta HIGUCHI | 43772d7 | 2014-12-03 13:57:09 -0800 | [diff] [blame] | 472 | /** |
| 473 | * Checks the async write result Futures and prepare Events to post. |
| 474 | * |
| 475 | * @param futures async write Futures |
| 476 | * @param failed list to output failed batch write operations |
| 477 | * @param events list to output events to post as result of writes |
| 478 | */ |
| 479 | private void verifyAsyncWrites(List<Pair<Operation, List<Future<?>>>> futures, |
| 480 | List<Operation> failed, |
| 481 | List<IntentEvent> events) { |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 482 | for (Pair<Operation, List<Future<?>>> future : futures) { |
| 483 | final Operation op = future.getLeft(); |
| 484 | final List<Future<?>> subops = future.getRight(); |
| 485 | |
| 486 | switch (op.type()) { |
| 487 | |
| 488 | case CREATE_INTENT: |
| 489 | { |
| 490 | Intent intent = op.arg(0); |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 491 | IntentState newIntentState = INSTALL_REQ; |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 492 | |
| 493 | try { |
| 494 | Intent prevIntent = (Intent) subops.get(0).get(); |
| 495 | IntentState prevIntentState = (IntentState) subops.get(1).get(); |
| 496 | |
| 497 | if (prevIntent != null || prevIntentState != null) { |
| 498 | log.warn("Overwriting existing Intent: {}@{} with {}@{}", |
| 499 | prevIntent, prevIntentState, |
| 500 | intent, newIntentState); |
| 501 | } |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 502 | events.add(IntentEvent.getEvent(INSTALL_REQ, intent)); |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 503 | } catch (InterruptedException e) { |
| 504 | log.error("Batch write was interrupted while processing {}", op, e); |
| 505 | failed.add(op); |
| 506 | Thread.currentThread().interrupt(); |
| 507 | } catch (ExecutionException e) { |
| 508 | log.error("Batch write failed processing {}", op, e); |
| 509 | failed.add(op); |
| 510 | } |
| 511 | break; |
| 512 | } |
| 513 | |
| 514 | case REMOVE_INTENT: |
| 515 | { |
| 516 | IntentId intentId = op.arg(0); |
| 517 | |
| 518 | try { |
| 519 | Intent prevIntent = (Intent) subops.get(0).get(); |
| 520 | IntentState prevIntentState = (IntentState) subops.get(1).get(); |
| 521 | @SuppressWarnings("unchecked") |
| 522 | List<Intent> prevInstallable = (List<Intent>) subops.get(2).get(); |
| 523 | |
| 524 | if (prevIntent == null) { |
| 525 | log.warn("Intent {} was already removed.", intentId); |
| 526 | } |
| 527 | if (prevIntentState == null) { |
| 528 | log.warn("Intent {} state was already removed", intentId); |
| 529 | } |
Pavlin Radoslavov | 0d972b9 | 2014-12-03 20:07:34 -0800 | [diff] [blame] | 530 | if (prevInstallable != null) { |
| 531 | log.warn("Intent {} removed installable still found", intentId); |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 532 | } |
| 533 | } catch (InterruptedException e) { |
| 534 | log.error("Batch write was interrupted while processing {}", op, e); |
| 535 | failed.add(op); |
| 536 | Thread.currentThread().interrupt(); |
| 537 | } catch (ExecutionException e) { |
| 538 | log.error("Batch write failed processing {}", op, e); |
| 539 | failed.add(op); |
| 540 | } |
| 541 | break; |
| 542 | } |
| 543 | |
| 544 | case SET_STATE: |
| 545 | { |
| 546 | Intent intent = op.arg(0); |
| 547 | IntentId intentId = intent.id(); |
| 548 | IntentState newState = op.arg(1); |
| 549 | |
| 550 | try { |
| 551 | IntentState prevIntentState = (IntentState) subops.get(0).get(); |
Yuta HIGUCHI | f568245 | 2014-12-01 10:17:15 -0800 | [diff] [blame] | 552 | |
| 553 | if (PARKING.contains(newState)) { |
| 554 | transientStates.remove(intentId); |
Yuta HIGUCHI | 5cd352d | 2014-12-01 20:16:02 -0800 | [diff] [blame] | 555 | events.add(IntentEvent.getEvent(newState, intent)); |
Yuta HIGUCHI | f568245 | 2014-12-01 10:17:15 -0800 | [diff] [blame] | 556 | } |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 557 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 558 | log.trace("{} - {} -> {}", intentId, prevIntentState, newState); |
| 559 | // TODO sanity check and log? |
| 560 | } catch (InterruptedException e) { |
| 561 | log.error("Batch write was interrupted while processing {}", op, e); |
| 562 | failed.add(op); |
| 563 | Thread.currentThread().interrupt(); |
| 564 | } catch (ExecutionException e) { |
| 565 | log.error("Batch write failed processing {}", op, e); |
| 566 | failed.add(op); |
| 567 | } |
| 568 | break; |
| 569 | } |
| 570 | |
| 571 | case SET_INSTALLABLE: |
| 572 | { |
| 573 | IntentId intentId = op.arg(0); |
| 574 | List<Intent> installableIntents = op.arg(1); |
| 575 | |
| 576 | try { |
| 577 | @SuppressWarnings("unchecked") |
| 578 | List<Intent> prevInstallable = (List<Intent>) subops.get(0).get(); |
| 579 | |
| 580 | if (prevInstallable != null) { |
| 581 | log.warn("Overwriting Intent {} installable {} -> {}", |
| 582 | intentId, prevInstallable, installableIntents); |
| 583 | } |
| 584 | } catch (InterruptedException e) { |
| 585 | log.error("Batch write was interrupted while processing {}", op, e); |
| 586 | failed.add(op); |
| 587 | Thread.currentThread().interrupt(); |
| 588 | } catch (ExecutionException e) { |
| 589 | log.error("Batch write failed processing {}", op, e); |
| 590 | failed.add(op); |
| 591 | } |
| 592 | break; |
| 593 | } |
| 594 | |
| 595 | case REMOVE_INSTALLED: |
| 596 | { |
| 597 | IntentId intentId = op.arg(0); |
| 598 | |
| 599 | try { |
| 600 | @SuppressWarnings("unchecked") |
| 601 | List<Intent> prevInstallable = (List<Intent>) subops.get(0).get(); |
| 602 | |
| 603 | if (prevInstallable == null) { |
| 604 | log.warn("Intent {} installable was already removed", intentId); |
| 605 | } |
| 606 | } catch (InterruptedException e) { |
| 607 | log.error("Batch write was interrupted while processing {}", op, e); |
| 608 | failed.add(op); |
| 609 | Thread.currentThread().interrupt(); |
| 610 | } catch (ExecutionException e) { |
| 611 | log.error("Batch write failed processing {}", op, e); |
| 612 | failed.add(op); |
| 613 | } |
| 614 | break; |
| 615 | } |
| 616 | |
| 617 | default: |
| 618 | log.warn("Unknown Operation encountered: {}", op); |
| 619 | if (!failed.contains(op)) { |
| 620 | failed.add(op); |
| 621 | } |
| 622 | break; |
| 623 | } |
| 624 | } |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 625 | } |
| 626 | |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 627 | public final class RemoteIntentsListener extends EntryAdapter<IntentId, Intent> { |
| 628 | |
| 629 | @Override |
| 630 | public void entryAdded(EntryEvent<IntentId, Intent> event) { |
| 631 | localIntents.put(event.getKey(), event.getValue()); |
| 632 | } |
| 633 | |
| 634 | @Override |
| 635 | public void entryUpdated(EntryEvent<IntentId, Intent> event) { |
| 636 | entryAdded(event); |
| 637 | } |
| 638 | } |
| 639 | |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 640 | public final class RemoteIntentStateListener extends EntryAdapter<IntentId, IntentState> { |
| 641 | |
| 642 | @Override |
| 643 | public void onEntryEvent(EntryEvent<IntentId, IntentState> event) { |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 644 | final IntentId intentId = event.getKey(); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 645 | final Member myself = theInstance.getCluster().getLocalMember(); |
| 646 | if (!myself.equals(event.getMember())) { |
| 647 | // When Intent state was modified by remote node, |
| 648 | // clear local transient state. |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 649 | IntentState oldState = transientStates.remove(intentId); |
| 650 | if (oldState != null) { |
| 651 | log.debug("{} state updated remotely, removing transient state {}", |
| 652 | intentId, oldState); |
| 653 | } |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 654 | |
Yuta HIGUCHI | 8837578 | 2014-12-02 14:21:17 -0800 | [diff] [blame] | 655 | if (event.getValue() != null) { |
| 656 | // notify if this is not entry removed event |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 657 | |
| 658 | final Intent intent = getIntent(intentId); |
| 659 | if (intent == null) { |
| 660 | log.warn("no Intent found for {} on Event {}", intentId, event); |
| 661 | return; |
| 662 | } |
| 663 | notifyDelegate(IntentEvent.getEvent(event.getValue(), intent)); |
| 664 | // remove IntentCache |
| 665 | localIntents.remove(intentId, intent); |
Yuta HIGUCHI | 8837578 | 2014-12-02 14:21:17 -0800 | [diff] [blame] | 666 | } |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 667 | } |
Yuta HIGUCHI | 9796cc6 | 2014-12-03 16:24:13 -0800 | [diff] [blame] | 668 | |
| 669 | // populate manual near cache, to prepare for |
| 670 | // transition event to WITHDRAWN |
| 671 | getIntent(intentId); |
Yuta HIGUCHI | 4490a73 | 2014-11-18 20:20:30 -0800 | [diff] [blame] | 672 | } |
| 673 | } |
| 674 | } |