Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3338

CancelQueryTask.forgetContext() could be simplified.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: Services, SQL
    • Labels:
      None

      Description

      Minor issue but CancelQueryTask.forgetContext() has this code (in GenericStatementContext.java)

      public void forgetContext() {
      boolean mayStillRun = !cancel();
      if (mayStillRun) {
      synchronized (this)

      { statementContext = null; }
      }
      }

      The mayStillRun = !cancel() is somewhat confusing. I can't see from the javadoc of TimerTask.cancel() how its return value could indicate the task may still run.
      Less confusing code could be:

      public void forgetContext() {
      synchronized (this) { statementContext = null; }

      cancel();
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mamtas Mamta A. Satoor
                Reporter:
                djd Daniel John Debrunner
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: