/** * Returns a new node. The node is retrieved (and removed) from the * released list or created new. */ private BlockIo getNewNode( long blockid ) throws IOException { BlockIo retval = null; if ( !free.isEmpty() ) { retval = free.removeFirst(); } if ( retval == null ) { retval = new BlockIo( 0, new byte[BLOCK_SIZE] ); } retval.setBlockId( blockid ); retval.setView( null ); return retval; }
/** * Returns a new node. The node is retrieved (and removed) from the * released list or created new. */ private BlockIo getNewNode( long blockid ) throws IOException { BlockIo retval = null; if ( ! free.isEmpty() ) { retval = ( BlockIo ) free.removeFirst(); } if ( retval == null ) { retval = new BlockIo( 0, new byte[BLOCK_SIZE] ); } retval.setBlockId(blockid); retval.setView( null ); return retval; }
/** * Returns a new BlockIo. The BlockIo is retrieved (and removed) from the * released list or created new. */ private BlockIo getNewBlockIo( long blockId ) throws IOException { BlockIo blockIo = null; if ( ! free.isEmpty() ) { blockIo = free.removeFirst(); blockIo.setBlockId( blockId ); } if ( blockIo == null ) { blockIo = new BlockIo( blockId, new byte[BLOCK_SIZE] ); } blockIo.setView( null ); return blockIo; }
/** * Returns a new node. The node is retrieved (and removed) * from the released list or created new. */ private BlockIo getNewNode(long blockid) throws IOException { BlockIo retval = null; if (!free.isEmpty()) { Iterator<BlockIo> it = free.valuesIterator(); retval = it.next(); it.remove(); } if (retval == null) retval = new BlockIo(0, new byte[BLOCK_SIZE]); retval.setBlockId(blockid); retval.setView(null); return retval; }