public interface

EntityObjectQueue

bucket.core.persistence.EntityObjectQueue
Known Indirect Subclasses

Class Overview

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 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.

Summary

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

Public Methods

public abstract 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.

public abstract 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.

public abstract 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.