Fix for MONDRIAN-1506. The SQL statements for segments are now registered in the segment cache index so that we can determine if it is safe or not to cancel a given statement. I have also tightened the handling of the different exceptions to make sure that we don't let any slip. This prevents a race condition that existed when the cancelation of the SQL statements was not noticed before a second query came in and used the very same segment entry form the index. This was causing the cancelation exception to bubble (rightfully) to the second query thread.