Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
-
Reviewed
Description
Lock lock = locks[i]; lock.lock(); try { ByteBuffer bb = buffers[i]; if (i == startBuffer) { cnt = bufferSize - startBufferOffset; if (cnt > len) cnt = len; ByteBuffer dup = bb.duplicate(); dup.limit(startBufferOffset + cnt).position(startBufferOffset); mbb[j] = dup.slice();
In asSubByteBuff, we work on the duplicate BB and set limit and position on that.. The locking is not needed here.
The locking is added because we set limit and position on the BBs in the array. We can duplicate the BBs and do positioning and limit on them. The locking can be fully avoided.