How to create named lock in java?
<p><strong> We can achive it in c# as follows- </strong></p>

<pre>

void readFile(File file)
{
      Mutex mutexForFile = null;                    
      bool mutexCreateFlag; // Return true/false based on whether mutext is already exist or it is created as part of current call
      mutexForFile = new Mutex(false, file.FullName.GetHashCode().ToString(), out mutexCreateFlag);                    
      if (!mutexCreateFlag)
          throw new Exception("File UsedByOtherProcess");
       else
       {
           mutexForFile .WaitOne();
           // synchronized access to resource
           ProcessFile(fileInfo: file);
           mutexForFile .ReleaseMutex();                    
       }
 }
</pre>

<p>Don't think about relevance of the code, just for example i have given</p>

<p>will somthing like this be possible in Java?</p>
