Long query may cause session to timeout
If a client application executes a query that takes a long time (longer than the cache.timeout setting in base.config), the session may timeout and the user is logged out. This will most likely result in a PermissionDeniedException when the result of the query is put together.
We need a way to mark a session as 'executing query' that will stop it from being timed out. One problem is that a single session may be used by multiple threads, so a simple flag is not enough. Maybe each query can be associated with a timer that "pings" the session at regular intervals.