Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10082

Transactional classes shouldn't also implement streams, channels, etc

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      Since the close method on the Transactional interface means "abort if commit hasn't been called", mixing Transactional and AutoCloseable interfaces where close means "we're done here" is pretty much never the right thing to do.

      The only class that does this is SequentialWriter. It's not used in a way that causes a problem, but it's still a potential hazard for future development.

      The attached patch replaces the SequentialWriter OutputStream implementation with a wrapper class that implements the expected behavior on close, and adds a warning to the Transactional interface. It also adds a unit test that demonstrates the problem without the fix.

      Attachments

        1. 0001-replacing-SequentialWriter-OutputStream-extension-wi.patch
          7 kB
          Blake Eggleston
        2. 10082-2.txt
          7 kB
          Blake Eggleston

        Issue Links

          Activity

            People

              bdeggleston Blake Eggleston
              bdeggleston Blake Eggleston
              Blake Eggleston
              Benedict Elliott Smith
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: