com.atlassian.bonnie.index
Interface ObjectQueue

All Known Implementing Classes:
SingletonObjectQueue

public interface ObjectQueue

Queue of objects that need to be indexed. Partitions the total collection of objects to be indexed into sub-collections that individual threads can grab and process.

An ObjectQueue MUST be read-only and MUST NOT be externally modified once it has been created.

There is no need for implementations to be thread-safe. Synchronization will be handled by clients.


Nested Class Summary
static interface ObjectQueue.Processor
          Creates Documents from objects via ObjectToDocumentConverter, then passes the created Document to a Callback.
 
Method Summary
 ObjectQueue.Processor getProcessor()
          Get this queue's processor.
 boolean hasMore()
          Are there more objects in the queue?
 java.util.Collection pop()
          Pops a block of objects to index.
 int size()
          Size of queue.
 

Method Detail

pop

public java.util.Collection pop()
Pops a block of objects to index. Returns a collection of objects instead of a single object to minimize lock contention.

Returns:
objects to index

hasMore

public boolean hasMore()
Are there more objects in the queue?

Returns:

size

public int size()
Size of queue. For Iterator-backed implementations, the size is not known. Clients should only use this method to obtain an approximation of the actual number of objects to index.

Returns:

getProcessor

public ObjectQueue.Processor getProcessor()
Get this queue's processor. Implementations must either return a thread-safe processor or a thread-local instance of the processor.

Returns:


Copyright © 2006-2009 Atlassian Software Systems Pty Ltd. All Rights Reserved.