All collections that descend from AbstractPersistentCollection have an operation queue that automagically defers certain operations to be performed later. (One operation that can be queued is adding an element to the collection. Another is clearing the collection.)
The following function determines whether to queue an operation or apply it immediately:
Code:
protected boolean isOperationQueueEnabled() {
return !initialized &&
isConnectedToSession() &&
isInverseCollection();
}
It is called at many points -- for example, when you .add() an item to a collection.
My question is this: Why queue operations only when the collection is an inverse collection? More generally, what's the reasoning behind these three criteria, and the queuing strategy as a whole?Thanks,
-John