0

How to lock a file in Hdfs path using scala.

So that the other process cannot access the locked file until it unlocks the file.

It need to be implemented in scala.

Ram Ghadiyaram
  • 30,194
  • 13
  • 83
  • 107
vijay
  • 1
  • 8
  • Why you want to do this ? what you are trying to do ? the reason why i am asking is you can have more elegant ways to address issues. java synchronization will work well with scala. but question remains same why... ? – Ram Ghadiyaram Nov 23 '18 at 05:57
  • Maxid.txt file contains the maxbatch id in it.I want to raed the id & increment the value .At the same time another process should not increment the value .When this process gets completed i need to unlock the file.So the other process can have acess to it. – vijay Nov 23 '18 at 06:04
  • okay have you seen [this](https://stackoverflow.com/questions/34877487/how-to-use-synchronized-in-scala)? – Ram Ghadiyaram Nov 23 '18 at 06:09
  • yeah i have seeen it ...Just a way to use lock for that .txt file..Is that applicable in scala – vijay Nov 23 '18 at 06:42

0 Answers0