+ private static void syncPath(Path f) throws IOException {\r
+ // Does not seem to need 's' according to unit test in Windows\r
+ boolean synced = false;\r
+ int count = 0;\r
+ while (!synced) {\r
+ try (RandomAccessFile raf = new RandomAccessFile(f.toFile(), "rw")) {\r
+ raf.getFD().sync();\r
+ synced = true;\r
+ } catch (IOException e) {\r
+ if (count == 3) {\r
+ throw e;\r
+ } else {\r
+ try {\r
+ Thread.sleep(50);\r
+ } catch (InterruptedException e1) {\r
+ e1.printStackTrace();\r
+ }\r
+ count++;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r