Returns and remove the recycled position if any.

@return the recycled position if found, otherwise -1 that usually means to request more space.
@throws IOException
179750
public long popLastEntryPosition() throws IOException {
    // BROWSE IN ASCENDING ORDER UNTIL A GOOD POSITION IS FOUND (!=-1)
    for (int pos = getHoles() - 1; pos >= 0; --pos) {
      final long recycledPosition = file.readLong(pos * RECORD_SIZE);

      if (recycledPosition > -1) {
        if (OLogManager.instance().isDebugEnabled())
          OLogManager.instance().debug(this, "Recycled hole %s/#%d -> #%d:%d", owner.getName(), pos, owner.getId(),
              recycledPosition);

        // SHRINK THE FILE
        file.removeTail((getHoles() - pos) * RECORD_SIZE);

        return recycledPosition;
      }
    }

    return -1;
  }
546042
@Override
	public void recycle() {
		for (int i = first; i != last; i = next(i)) {
			bufs[i].recycle();
		}
		first = last = 0;
	}
1373235
public void recycle() {
    	while(buffer.size()>0)
    		buffer.poll().recycle();
    	
    	if(activeFrame!=null)
    		activeFrame.recycle();
    	
        activeFrame=null;
		activeData=null;
		byteIndex=0;		        
    }
551792
public IVarDef.Position getPosition()
    {
    if( position_ == null)
      {
      setPosition( new Position( getParent(), seqNum_));
      }
    
    return position_;
    }
196310
public int read() throws IOException {
    if (chunk == null || pos + 1 == chunk.length) {
      if (!fetchChunk()) {
        return -1;
      }
    }
    return chunk[pos++] & 0xff;
  }
11204
public int freeBytes()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "freeBytes", this);

        int freeBytes = 0;

        try
        {
            int currentCursorPosition = _fileBuffer.position();
            int fileLength = _fileBuffer.capacity();

            freeBytes = fileLength - currentCursorPosition;

            if (freeBytes < 0)
            {
                freeBytes = 0;
            }
        } catch (Throwable exc)
        {
            FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.freeBytes", "956", this);
            freeBytes = 0;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "freeBytes", new Integer(freeBytes));

        return freeBytes;
    }
38924
def _recycle(self):
        
        origin = self._origin
        if origin == 0:
            return False
        available = self._extent - origin
        self._data[:available] = self._data[origin:self._extent]
        self._extent = available
        self._origin = 0
        #log_debug("Recycled %d bytes" % origin)
        return True
983091
public int allocateSpace(final int iSize) throws IOException {
    final int offset = getFilledUpTo();
    final int size = getFileSize();

    if (getFreeSpace() < iSize) {
      if (maxSize > 0 && maxSize - size < iSize)
        throw new IllegalArgumentException("Cannot enlarge file since the configured max size ("
            + OFileUtils.getSizeAsString(maxSize) + ") was reached! " + toString());

      // MAKE ROOM
      int newFileSize = size;

      if (newFileSize == 0)
        // PROBABLY HAS BEEN LOST WITH HARD KILLS
        newFileSize = DEFAULT_SIZE;

      // GET THE STEP SIZE IN BYTES
      int stepSizeInBytes = incrementSize > 0 ? incrementSize : -1 * size / 100 * incrementSize;

      // FIND THE BEST SIZE TO ALLOCATE (BASED ON INCREMENT-SIZE)
      while (newFileSize - offset <= iSize) {
        newFileSize += stepSizeInBytes;

        if (newFileSize == 0)
          // EMPTY FILE: ALLOCATE REQUESTED SIZE ONLY
          newFileSize = iSize;
        if (newFileSize > maxSize && maxSize > 0)
          // TOO BIG: ROUND TO THE MAXIMUM FILE SIZE
          newFileSize = maxSize;
      }

      setSize(newFileSize);
    }

    // THERE IS SPACE IN FILE: RETURN THE UPPER BOUND OFFSET AND UPDATE THE FILLED THRESHOLD
    setFilledUpTo(offset + iSize);

    return offset;
  }
676685
public void removePhysicalPosition(final long iPosition) throws IOException {
    final long position = iPosition * RECORD_SIZE;

    acquireExclusiveLock();
    try {

      final long[] pos = fileSegment.getRelativePosition(position);
      final OFile file = fileSegment.files[(int) pos[0]];
      final long p = pos[1] + OBinaryProtocol.SIZE_SHORT + OBinaryProtocol.SIZE_LONG + OBinaryProtocol.SIZE_BYTE;

      holeSegment.pushPosition(position);

      // MARK DELETED SETTING VERSION TO NEGATIVE NUMBER
      final int version = file.readInt(p);
      file.writeInt(p, (version + 1) * -1);

      updateBoundsAfterDeletion(iPosition);

    } finally {
      releaseExclusiveLock();
    }
  }
174190
public long size() throws IOException {
		if (filter == null) return size;
		if (filteredSize == - 1) {
			long c = 0;
			final long[] triple = new long[3];
			final ByteBuffer iteratorByteBuffer = ByteBuffer.allocateDirect(BUFFER_SIZE).order(ByteOrder.nativeOrder());
			for(int i = 0; i < DISK_CHUNKS; i++) {
				if (filter == null) c += count[i];
				else {
					flushAll();
					@SuppressWarnings("resource")
					final ReadableByteChannel channel = new FileInputStream(file[i]).getChannel();
					iteratorByteBuffer.clear().flip();
					for(int j = 0; j < count[i]; j++) {
						triple[0] = readLong(iteratorByteBuffer, channel);
						triple[1] = readLong(iteratorByteBuffer, channel);
						triple[2] = readLong(iteratorByteBuffer, channel);
						if (hashMask == 0) readLong(iteratorByteBuffer, channel);
						if (filter.evaluate(triple)) c++;
					}
					channel.close();
				}
			}

			filteredSize = c;
		}
		return filteredSize;
	}
1334084
@Override
    public T remove(int index) {
        /* Cache the value at the indicated position; this also does the bounds
         * check.
         */
        T result = get(index);

        /* Use a naive shuffle-down algorithm to reposition elements after
         * the removed one.
         */
        for (int i = index + 1; i < size(); ++i)
            set(i - 1, get(i));

        /* Clobber the last element to play nicely with the garbage collector. */
        set(size() - 1, null);

        /* Decrement our size. */
        --mSize;

        /* If we are now at 1/8 total capacity, shrink the structure. */
        if (size() * 8 <= mArrays.length * mArrays.length)
            shrink();
            /* Otherwise, if the size is now an even multiple of the array size,
             * we can drop the very last array.  This is the array whose offset
             * is one after the end of the elements.
             */
        else if (size() % mArrays.length == 0)
            mArrays[computeOffset(size())] = null;

        return result;
    }
816828
public int getNodeByPosition(int position)
  {
    if (position > 0) {
      final int pos = isReverse() ? getLast() - position + 1
                                   : position;
      int node;
      while ((node = next()) != DTMAxisIterator.END) {
        if (pos == getPosition()) {
          return node;
        }
      }
    }
    return END;
  }
199516
public final int next() throws IOException {
        if (m_nextException!=null) {
            throw m_nextException;
        }
        try {
            return doNext();
        }
        catch (IOException e) {
            m_nextException=e;
            resetState();
            throw e;
        }
    }
1228582
public T removeLast()
   {
      T element = elementData[--size];
      elementData[size] = null;
      return element;
   }
635536
public long getUsed() throws IOException{
    long used = 0;
    FileStatus[] files = listStatus(new Path("/"));
    for(FileStatus file:files){
      used += file.getLen();
    }
    return used;
  }
597792
public int readReverse() throws IOException {
		int b;
		do {
			canRead.block(0);
			synchronized (this) {
				if (error != null) throw error;
				if (io == null) throw new IOException("IO closed");
				// check if we reached the beginning of the file
				if (bufferPosInFile == 0 && posInBuffer == minInBuffer) return -1;
				if (posInBuffer == minInBuffer) {
					// we are reading faster than buffering
					if (currentRead != null)
						canRead.restart();
					else
						readBufferBack();
					b = -1;
				} else {
					b = buffer[--posInBuffer] & 0xFF;
					if (currentRead == null && posInBuffer < buffer.length / 2 && bufferPosInFile > 0)
						readBufferBack();
				}
			}
		} while (b == -1);
		return b;
	}
844907
public synchronized long get() throws IOException {
    try {
      lastZNodeStat = zooKeeper.exists(fullyQualifiedZNode, false);
      if (lastZNodeStat == null) {
        return -1;
      }
      byte[] data =
          zooKeeper.getData(fullyQualifiedZNode, false, lastZNodeStat);
      WritableUtil.readWritableFromByteArray(data, maxTxIdWritable);
      return maxTxIdWritable.get();
    } catch (KeeperException e) {
      keeperException("Unrecoverable ZooKeeper error reading " +
          fullyQualifiedZNode, e);
      return -1; // This is never reached
    } catch (InterruptedException e) {
      interruptedException("Interrupted reading " +
          fullyQualifiedZNode, e);
      return -1; // This is never reached
    }
  }