harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject [classlib][nio] [question] Synchronization issue on MappedByteBuffer ?
Date Mon, 03 Jul 2006 03:13:56 GMT
Hello everyone,

I noticed there are several FIXMEs in MappedByteBufferAdapter.java, which
are related to synchronization issue.

Following FIXME is for getChar() method:

// FIXME Need synchronization as far as the update of this.position is
concerned of the following methods? Spec does not say whether
MappedByteBuffer is thread safe. It is the decision we should make.

I read through MappedByteBuffer javadoc, and didn't find any description
about concurrent & synchronization. The spec on MappedByteBuffer emphasizes
"All or part of a mapped byte buffer may become inaccessible at any time",
and in the end, it mentions "Mapped byte buffers otherwise behave no
differently than ordinary direct byte buffers."

Spec doesn't mention any synchronization issues on direct byte buffers
either. Therefore, in my opnion, only synchronizing for MappedByteBuffer is
unnecessary.

Any comments? or may I miss something? Thanks!

Best regards,


-- 
Andrew Zhang
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message