Derby
  1. Derby
  2. DERBY-5541

Remove unnecessary field rwsOK in DirStorageFactory4

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.1.0
    • Component/s: Store
    • Labels:
      None

      Description

      DirStorageFactory4 has a field called rwsOK defined like this:

      private static final boolean rwsOK = JVMInfo.JDK_ID >= JVMInfo.J2SE_142;

      The only supported platform whose JVMInfo.JDK_ID is less than JVMInfo.J2SE_142, is FP/CDC. But DirStorageFactory4 is not used on FP/CDC because it depends on NIO. This means that the field will always have the value true, and it can be eliminated.

      1. d5541.diff
        4 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        The attached patch removes the field rwsOK from DirStorageFactory4 and all uses of it. There is also an rwsOK field in DirFile4, which gets its value from DirStorageFactory4.rwsOK, so that field is removed too.

        The only uses of these fields are:

        1) A condition in DirFile4.getRandomAccessFile(), which always evaluates to false on the currently supported platforms, and the whole if statement is therefore removed.

        2) Its value is returned by DirStorageFactory4.supportsWriteSync(). Now it returns true unconditionally.

        All the regression tests ran cleanly with the patch.

        Show
        Knut Anders Hatlen added a comment - The attached patch removes the field rwsOK from DirStorageFactory4 and all uses of it. There is also an rwsOK field in DirFile4, which gets its value from DirStorageFactory4.rwsOK, so that field is removed too. The only uses of these fields are: 1) A condition in DirFile4.getRandomAccessFile(), which always evaluates to false on the currently supported platforms, and the whole if statement is therefore removed. 2) Its value is returned by DirStorageFactory4.supportsWriteSync(). Now it returns true unconditionally. All the regression tests ran cleanly with the patch.
        Hide
        Dag H. Wanvik added a comment -

        The changes look good to me. +1

        Show
        Dag H. Wanvik added a comment - The changes look good to me. +1
        Hide
        Knut Anders Hatlen added a comment -

        Thanks, Dag! Committed revision 1220670.

        Show
        Knut Anders Hatlen added a comment - Thanks, Dag! Committed revision 1220670.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development