public TransactionInfoBaseMessage nextTask ( ) throws IOException { if ( ! hasMoreEntries ( ) ) { return null ; } ByteBuffer bb = m_container . b ( ) ; int position = bb . position ( ) ; int length = bb . getInt ( ) ; long sourceHSId = bb . getLong ( ) ; VoltDbMessageFactory factory = new VoltDbMessageFactory ( ) ; /* * create a new buffer that just contains the message, deserialization * of the messsage may assert on the capacity of the buffer */ final int oldLimit = bb . limit ( ) ; bb . limit ( bb . position ( ) + length ) ; ByteBuffer slice = bb . slice ( ) ; bb . limit ( oldLimit ) ; VoltMessage msg = factory . createMessageFromBuffer ( slice , sourceHSId ) ; // createMessageFromBuffer() doesn't move the position pointer, set it here bb . position ( position + length + 8 + 4 ) ; // sourceHSId + buf len return ( TransactionInfoBaseMessage ) msg ; }
Get the next task message in this buffer .