My Java program is packaged as an .exe and will run on a Web server. If more
than one user is utilizing our Web site, more than one instance of this .exe
file might be running concurrently.

The program needs to read information from some files on the Web server.
The Java code that opens and reads the files does not lock the files. I'll
need to lock the files while they are being read so that two instances of
the .exe don't try to read the same file at the same time.

Here is the code that opens the file, reads it, and closes it:

String metricsFilePath = "MyMetricsFile.afm";
File metricsFile = null;
FileReader In = null;

try
{
metricsFile = new File(metricsFilePath);
In = new FileReader(metricsFilePath);

... Read the file ...
}
catch(FileNotFoundException e)
{
throw new FileNotFoundException("\r\nCan't find file \"" + metricsFilePath
+ "\", which is the font-metrics file for the " + fontName + " font");
}
catch(IOException e)
{
throw new IOException("\r\nCan't read file \"" + metricsFilePath + "\",
which is the font-metrics file for the " + fontName + " font");
}
finally
{
if(In != null) {In.close();}
}

Can somebody tell me how to enhance this code so that it locks and unlocks
the file?

Thanks.