commit | 978d2417da774efd927566ce9c56ecb38d34f4cc | [log] [tgz] |
---|---|---|
author | alshabib <alshabibi.ali@gmail.com> | Sat Nov 29 15:29:15 2014 -0800 |
committer | alshabib <alshabibi.ali@gmail.com> | Sat Nov 29 15:29:46 2014 -0800 |
tree | b0b26482eac6651688ea80950cdb72d51102e403 | |
parent | c1cc81c3d77c6fc3849c228cc993a83d2d4a6b10 [diff] |
add iterator support to SQueue Change-Id: I83df62326e54368e40fa15df522c05ba2dc67ff6
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/hz/SQueue.java b/core/store/dist/src/main/java/org/onlab/onos/store/hz/SQueue.java index f560cd2..29aced1 100644 --- a/core/store/dist/src/main/java/org/onlab/onos/store/hz/SQueue.java +++ b/core/store/dist/src/main/java/org/onlab/onos/store/hz/SQueue.java
@@ -15,6 +15,7 @@ */ package org.onlab.onos.store.hz; +import com.google.common.collect.Lists; import com.hazelcast.core.IQueue; import com.hazelcast.core.ItemListener; import com.hazelcast.monitor.LocalQueueStats; @@ -22,6 +23,7 @@ import java.util.Collection; import java.util.Iterator; +import java.util.List; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull; @@ -145,7 +147,9 @@ @Override public Iterator<T> iterator() { - throw new UnsupportedOperationException(); + List<T> list = Lists.newArrayList(); + q.forEach(elem -> list.add(deserialize(elem))); + return list.iterator(); } @Override
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/HazelcastIntentBatchQueue.java b/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/HazelcastIntentBatchQueue.java index 5e9499a..b75e6a4 100644 --- a/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/HazelcastIntentBatchQueue.java +++ b/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/HazelcastIntentBatchQueue.java
@@ -47,6 +47,7 @@ import java.util.Map; import java.util.Set; + import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static org.slf4j.LoggerFactory.getLogger;