bug with File.mkdir? (original) (raw)

jjian fan xiaofanhadoop at gmail.com
Mon Jul 30 00:53:46 UTC 2012


Hi: Guys, anyone knows there is any bug in Java.io.File.mkdir? In our high cocurrent scala message system, we create directory like ax-0,ax-1,ax-2, but File.mkdir sometimes just create directory ax. The function is like as:

private val fsLock = new ReentrantLock(); private def createLog(topic: String, partition: Int): = { fsLock.lock() try { val d = new File(logDir, topic + "-" + partition)

  if(!d.exists()) {
   if(d.mkdir())
      info("create directory " + d.getAbsolutePath()+" is success")
  }
 else
   {
    info("Directory " + topic + "-" + partition + " is existed")
   }

}
finally
  {
     fsLock.unlock()
  }

}

Java version is "1.7.0_05-icedtea".

Thanks! Best Regards! Jian Fan



More information about the core-libs-dev mailing list