mthornton at optrak.com
Sat Nov 3 02:21:29 PDT 2012
On 03/11/12 02:59, Zhong Yu wrote:
> (cc Doug: a non-trivial use case for ReentrantLock.isHeldByCurrentThread())
> On Fri, Nov 2, 2012 at 5:24 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>> On 02/11/2012 01:29, Jeff Hain wrote:
>> That's modulo the fact that MappedByteBuffers can't be
>> explicitly and portably unmapped (Bug ID: 4724038), so
>> you can't always use them.
>> Yes, a very difficult issue that many people have looked at but didn't come
>> up a solution that addresses all the concerns, see:
> (I just saw it questioned on SO: http://stackoverflow.com/questions/13204656 )
> I think we can solve the problem by enforcing that any thread
> accessing the buffer must "own" it first, and there can only be one
That wouldn't be compatible with existing use of MappedByteBuffer.
However you could perhaps apply that strategy to a new class (possibly a
subclass of MappedByteBuffer). You could do without the disown() method
--- legal usage would still be legal, only faulty use might get an
exception in a different place.
More information about the nio-dev