public void unpinPage(PageId PageId_in_a_DB, boolean dirty) throws 
    ReplacerException, 
    PageUnpinnedException, 
    HashEntryNotFoundException, 
    InvalidFrameNumberException {
      
    // Current frame descriptor index
    int frameNo = hashTable.lookup(PageId_in_a_DB);
    
    // Current frame descriptor
    FrameDesc frame; 
    
    // If the pageId is not found in the Page Table
    if (frameNo < 0) 
      throw new HashEntryNotFoundException (null, "BUFMGR: Hash entry not found");
    
    // Set the frame descriptor  
    frame = frmeTable[frameNo];
      
    // If the page returned is an INVALID_PAGE
    if (frame.pageNo.pid == INVALID_PAGE)
      throw new InvalidFrameNumberException (null, "BUFMGR: Invalid page no.");
    
    // If we are unable to unpin the frame
    if ((replacer.unpin(frameNo)) == false) 
      throw new ReplacerException (null, "BUFMGR: Unable to unpin page in the replacer.");
    
    // Sets the dirty bit in the frame descriptor
    if (dirty == true)
      frame.dirty = dirty;
      
  }  // end unpinPage()