What is the purpose of write.lock file, when is it used, and by which classes?

Otis Gospodnetic

The write.lock is used to keep processes from concurrently attempting to modify an index.

It is obtained by an IndexWriter while it is open, and by an IndexReader once documents have been deleted and until it is closed.