Allocation allocate ( Mutation mutation , int size ) { final OpOrder . Group opGroup = appendOrder . start ( ) ; try { int position = allocate ( size ) ; if ( position < 0 ) { opGroup . close ( ) ; return null ; } markDirty ( mutation , position ) ; return new Allocation ( this , opGroup , position , ( ByteBuffer ) buffer . duplicate ( ) . position ( position ) . limit ( position + size ) ) ; } catch ( Throwable t ) { opGroup . close ( ) ; throw t ; } }
Allocate space in this buffer for the provided mutation and return the allocated Allocation object . Returns null if there is not enough space in this segment and a new segment is needed .