|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ebay.erl.mobius.core.collection.BigTupleList
public class BigTupleList
Stores one to many Tuple
elements.
By default, the tuples are stored in memory, but if the memory is insufficient, the tuples are flushed into underlying file system.
When iterating the Tuple
elements using
iterator()
, the tuples are sorted based
on the comparator if it is provided in the
constructor, otherwise it would be in the insertion
order.
This product is licensed under the Apache License, Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. This product contains portions derived from Apache hadoop which is licensed under the Apache License, Version 2.0, available at http://hadoop.apache.org. © 2007 – 2012 eBay Inc., Evan Chiu, Woody Zhou, Neel Sundaresan
Field Summary | |
---|---|
static BigTupleList |
ZERO_SIZE_UNMODIFIABLE
A immutable zero size BigTupleList . |
Constructor Summary | |
---|---|
BigTupleList(java.util.Comparator<Tuple> comparator,
org.apache.hadoop.mapred.Reporter reporter)
Create an instance of BigTupleList with
specified comparator . |
|
BigTupleList(org.apache.hadoop.mapred.Reporter reporter)
Create an instance of BigTupleList
with default comparator (Tuple ). |
Method Summary | |
---|---|
void |
add(Tuple newTuple)
Add a new Tuple into this BigTupleList . |
void |
addAll(java.util.Collection<Tuple> collection)
Add all the tuples in collection into
this list. |
void |
addAll(java.lang.Iterable<Tuple> collection)
Add all the tuples in collection into
this list. |
void |
clear()
Remove all Tuple in this BigTupleList |
BigTupleList |
clone()
Make a deep clone of this list and return a new instance. |
long |
getEstimatedSizeInMemory()
|
Tuple |
getFirst()
|
void |
handleNotification(javax.management.Notification notification,
java.lang.Object handback)
When the used memory exceed the threshold. |
static BigTupleList |
immutable(BigTupleList list)
Create a new instance of immutable BigTupleList
which has identical content of the given list . |
boolean |
isMutable()
Check if this list is mutable or not. |
CloseableIterator<Tuple> |
iterator()
Create an iterator for iterating the Tuple in this list. |
long |
size()
return the total number of Tuple stored in this
BigTupleList |
void |
update(java.util.Observable o,
java.lang.Object arg)
Listening to JVM shutdown signal. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BigTupleList ZERO_SIZE_UNMODIFIABLE
BigTupleList
.
Constructor Detail |
---|
public BigTupleList(org.apache.hadoop.mapred.Reporter reporter)
BigTupleList
with default comparator (Tuple
).
public BigTupleList(java.util.Comparator<Tuple> comparator, org.apache.hadoop.mapred.Reporter reporter)
BigTupleList
with
specified comparator
.
Tuple
s stored in this list is sorted by
the comparator
Method Detail |
---|
public Tuple getFirst()
public boolean isMutable()
public static BigTupleList immutable(BigTupleList list)
BigTupleList
which has identical content of the given list
.
This method returns a new instance, so list
is still mutable.
public void add(Tuple newTuple)
BigTupleList
.
java.lang.UnsupportedOperationException
- if this list is immutable.public void addAll(java.lang.Iterable<Tuple> collection)
collection
into
this list.
java.lang.UnsupportedOperationException
- if this list is immutable.public void addAll(java.util.Collection<Tuple> collection)
collection
into
this list.
java.lang.UnsupportedOperationException
- if this list is immutable.public long size()
Tuple
stored in this
BigTupleList
public long getEstimatedSizeInMemory()
public void clear()
Tuple
in this BigTupleList
public void handleNotification(javax.management.Notification notification, java.lang.Object handback)
If the number of tuples in this list is greater or equals to 1000, all the tuples will be saved into disk.
handleNotification
in interface javax.management.NotificationListener
public void update(java.util.Observable o, java.lang.Object arg)
If JVM shutdown normally, this method will be called
and clear()
will be called to remove all
the stored tuples.
update
in interface java.util.Observer
JVMShutdownNotifier
public BigTupleList clone()
Tuples in memory will be cloned and the files store tuples in this list will be duplicated and stored in the returned list.
Since it's a deep clone, make changes to this list won't change the returned clone.
Mutable or not of the return clone is the same as this list.
clone
in class java.lang.Object
public CloseableIterator<Tuple> iterator()
Tuple
in this list.
The Tuple
s are sorted by a
comparator, either the default one (
Tuple
) or the specified one
in #BigTupleList(Comparator)
It's it very important to invoke the
CloseableIterator.close()
after
the iteration is done, whether the elements
insides have been all iterated or not.
iterator
in interface java.lang.Iterable<Tuple>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |