bucket.core.persistence
Interface EntityObjectQueue

All Known Implementing Classes:
HibernateEntityObjectQueue

public interface EntityObjectQueue

Retrieves objects from a list of their handles. The queue will consume the list of handles as it runs, so multiple queues can run against a single list of handles in different threads.

These are useful if you are performing an operation against a lot of objects, but don't want to load all the objects at once. You can get their Handles, and then run through them and have the queue lazy-load the objects in smaller batches.

Retrieve the queue appropriate to your DAO implementation using EntityObjectQueueFactory.getEntityObjectQueue(java.util.List).

It is not safe to give the same queue to multiple threads. However, if each thread has a different queue sharing the same set of handles, they will run through the handles safely in parallel.

The queue may re-order the list if it means it can retrieve the objects more efficiently.


Method Summary
 void clearCaches()
          Clear any underlying caches that might be kept as the queue is run through.
 void close()
          Release all resources (i.e.
 List getNextObjects()
          Get a collection of the next "group" of objects from the queue.
 

Method Detail

getNextObjects

List getNextObjects()
Get a collection of the next "group" of objects from the queue. The size of this group is determined by the queue itself, it's just a "reasonable" size for the underlying implementation. If there are no more objects available, an empty list will be returned.

Returns:
the next "group" of objects from the queue, or the empty list if there are no more objects available.

close

void close()
Release all resources (i.e. database connections) held by the queue. Anyone who retrieves a queue is responsible for closing it when they are done.


clearCaches

void clearCaches()
Clear any underlying caches that might be kept as the queue is run through. This is an efficiency measure for when an operation is running through a large number of objects, and the underlying DAO implementation hangs on to memory for the entire session.



Copyright © 2003-2012 Atlassian. All Rights Reserved.