Code example for ClosedChannelException

0
     * @see java.nio.channels.FileLock#release() 
     */ 
    @Override 
    public void release() throws IOException { 
        if (!channel().isOpen()) {
            throw new ClosedChannelException();
        } 
 
        if (!isReleased) {
            ((FileChannelImpl) channel()).release(this);
            isReleased = true;
        } 
    } 
}