[concurrency-interest] Thread-safe iterator

Johannes.Lichtenberger Johannes.Lichtenberger at uni-konstanz.de
Fri Feb 17 11:42:01 EST 2012

On 02/17/2012 04:54 PM, Johannes.Lichtenberger wrote:
> On 02/17/2012 07:42 AM, chakravarthy.varaga at wipro.com wrote:
>> Hi,
>> 	Is there a guarantee that your protected final long resetToLastKey() is not accessed outside your iteration and your concrete next() implementation isn't accessed outside the transaction?
> Well, next() is implemented in the abstract skeleton implementation with
> a simple mWtx.moveTo(nextKey); and it should in general never be
> overriden, but that must be properly documented.
> resetToLastKey() also should never be exposed, but it has to be
> protected as the abstract skeleton impl. is used from other packages.

More precisely:

    public final Long next() {
        if (!mNext) {
        mNext = false;
        return mNextKey;

BTW: next() is the method which implements the method from Iterable<Long>.

kind regards,

More information about the Concurrency-interest mailing list