Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1249198

There needs to be an file operation that forces data to disk.

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified


      This is a note from a Java ISV who would like to implement a simple,
      transactional data store in Java. Currently this can't be done in Java.

      A 'force data to disk' method needs to be added to both FileOutputStream and RandomAccessFile.


      We are building a simple transaction facility in Java, based on files
      in the underlying file system. We need a way to ensure that all
      modifications to a file are recorded on disk, i.e. written from any
      operating system buffers or caches to the actual disk, in order to
      guarantee our ability to perform recovery operations after a system
      crash.

      We'd like a way to perform this operation from Java. be added by
      having java.io.FileOutputStream override the "flush" method, or by
      adding a new method to java.io.FileOutputStream, for example.

      Solaris, and all modern Unix systems, provide an "fsync" system call,
      which does just what we need. (All Unix systems at least provide a
      "sync" system call, which is also fine although "fsync" is
      preferable.) Windows NT provides "FlushFileBuffers", and OS/2
      provides "DosResetBuffer". So there's no problem providing this
      operation portably.

      ------------------------------------------------------

      Ken Arnold says: I will need this for JavaSpaces, since I will need to implement
      transactions. For me this is a serious requirement.

            djbrown David Brown (Inactive)
            mhapnersunw Mark Hapner (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: