CancelQueryTask.forgetContext() could be simplified.
----------------------------------------------------

                 Key: DERBY-3338
                 URL: https://issues.apache.org/jira/browse/DERBY-3338
             Project: Derby
          Issue Type: Improvement
          Components: Newcomer, Services, SQL
            Reporter: Daniel John Debrunner
            Priority: Minor


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();
        }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to