ca.uhn.cache.util
Class MutableMergeableIterator

java.lang.Object
  extended byca.uhn.cache.util.MutableIterator
      extended byca.uhn.cache.util.MutableMergeableIterator
All Implemented Interfaces:
IMutableIterator, IMutableMergeableIterator, java.util.Iterator

public class MutableMergeableIterator
extends MutableIterator
implements IMutableMergeableIterator

Default implementation of IMutableMergeableIterator.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/26 00:25:50 $ by $Author: bryan_tripp $
Author:
Bryan Tripp

Constructor Summary
MutableMergeableIterator()
          New instance with default Executor.
MutableMergeableIterator(EDU.oswego.cs.dl.util.concurrent.Executor theExecutor)
           
 
Method Summary
 void close()
          Closes merged IMutableIterators.
 void freeze()
          Waits until all in-progress merges are complete, then calls super.freeze().
 void merge(java.util.Iterator theIterator)
          Incorporates the contents of the given iterator into this one.
 
Methods inherited from class ca.uhn.cache.util.MutableIterator
add, declareException, hasNext, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.uhn.cache.util.IMutableIterator
add, declareException
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

MutableMergeableIterator

public MutableMergeableIterator(EDU.oswego.cs.dl.util.concurrent.Executor theExecutor)
Parameters:
theExecutor - to manage threading

MutableMergeableIterator

public MutableMergeableIterator()
New instance with default Executor.

Method Detail

merge

public void merge(java.util.Iterator theIterator)
Description copied from interface: IMutableMergeableIterator
Incorporates the contents of the given iterator into this one. No guarantees are made as to the resulting ordering of elements. If the given iterator is an IMutableIterator, and close() is called some time in the future, then close() will be called on the merged IMutableIterator as well.

Specified by:
merge in interface IMutableMergeableIterator
Parameters:
theIterator - another Iterator to combine with this one
See Also:
IMutableMergeableIterator.merge(java.util.Iterator)

freeze

public void freeze()
Waits until all in-progress merges are complete, then calls super.freeze(). Note that it's possible to continue calling add() in the mean time ... but don't, because you never know when the merges will finish.

Specified by:
freeze in interface IMutableIterator
Overrides:
freeze in class MutableIterator
See Also:
ca.uhn.cache.IMutableIterator#freeze()

close

public void close()
Closes merged IMutableIterators. Override if you need to do more here. But don't forget to call super.close().

Specified by:
close in interface IMutableIterator
Overrides:
close in class MutableIterator
See Also:
ca.uhn.cache.IMutableIterator#close()


Copyright © 2004-2005 University Health Network. All Rights Reserved.