类 Chunk<W>

  • 所有已实现的接口:
    java.lang.Iterable<W>

    public class Chunk<W>
    extends java.lang.Object
    implements java.lang.Iterable<W>
    Encapsulation of a list of items to be processed and possibly a list of failed items to be skipped. To mark an item as skipped clients should iterate over the chunk using the iterator() method, and if there is a failure call Chunk.ChunkIterator.remove() on the iterator. The skipped items are then available through the chunk.
    从以下版本开始:
    2.0
    作者:
    Dave Syer
    • 构造器概要

      构造器 
      构造器说明
      Chunk() 
      Chunk​(java.util.Collection<? extends W> items) 
      Chunk​(java.util.Collection<? extends W> items, java.util.List<SkipWrapper<W>> skips) 
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidadd​(W item)
      Add the item to the chunk.
      voidclear()
      Clear the items down to signal that we are done.
      voidclearSkips()
      Clear only the skips list.
      java.util.List<java.lang.Exception>getErrors() 
      java.util.List<W>getItems() 
      java.util.List<SkipWrapper<W>>getSkips() 
      java.lang.ObjectgetUserData() 
      booleanisBusy()
      Query the chunk to see if anyone has registered an interest in keeping a reference to it.
      booleanisEmpty() 
      booleanisEnd()
      Flag to indicate if the source data is exhausted.
      Chunk.ChunkIteratoriterator()
      Get an unmodifiable iterator for the underlying items.
      voidsetBusy​(boolean busy)
      Register an interest in the chunk to prevent it from being cleaned up before the flag is reset to false.
      voidsetEnd()
      Set the flag to say that this chunk represents an end of stream (there is no more data to process).
      voidsetUserData​(java.lang.Object userData) 
      intsize() 
      voidskip​(java.lang.Exception e)
      Register an anonymous skip.
      java.lang.StringtoString() 
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • 从接口继承的方法 java.lang.Iterable

        forEach, spliterator
    • 构造器详细资料

      • Chunk

        public Chunk​(java.util.Collection<? extends W> items)
      • Chunk

        public Chunk​(java.util.Collection<? extends W> items,
                     java.util.List<SkipWrapper<W>> skips)
    • 方法详细资料

      • add

        public void add​(W item)
        Add the item to the chunk.
        参数:
        item - the item to add
      • clear

        public void clear()
        Clear the items down to signal that we are done.
      • getItems

        public java.util.List<WgetItems()
        返回:
        a copy of the items to be processed as an unmodifiable list
      • getSkips

        public java.util.List<SkipWrapper<W>> getSkips()
        返回:
        a copy of the skips as an unmodifiable list
      • getErrors

        public java.util.List<java.lang.Exception> getErrors()
        返回:
        a copy of the anonymous errors as an unmodifiable list
      • skip

        public void skip​(java.lang.Exception e)
        Register an anonymous skip. To skip an individual item, use Chunk.ChunkIterator.remove().
        参数:
        e - the exception that caused the skip
      • isEmpty

        public boolean isEmpty()
        返回:
        true if there are no items in the chunk
      • iterator

        public Chunk.ChunkIterator iterator()
        Get an unmodifiable iterator for the underlying items.
        指定者:
        iterator 在接口中 java.lang.Iterable<W>
        另请参阅:
        Iterable.iterator()
      • size

        public int size()
        返回:
        the number of items (excluding skips)
      • isEnd

        public boolean isEnd()
        Flag to indicate if the source data is exhausted.
        返回:
        true if there is no more data to process
      • setEnd

        public void setEnd()
        Set the flag to say that this chunk represents an end of stream (there is no more data to process).
      • isBusy

        public boolean isBusy()
        Query the chunk to see if anyone has registered an interest in keeping a reference to it.
        返回:
        the busy flag
      • setBusy

        public void setBusy​(boolean busy)
        Register an interest in the chunk to prevent it from being cleaned up before the flag is reset to false.
        参数:
        busy - the flag to set
      • clearSkips

        public void clearSkips()
        Clear only the skips list.
      • setUserData

        public void setUserData​(java.lang.Object userData)
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object