HiveSessionManager is a Runnable started inside a web application context.
It's basic function is to hold a collection of SessionItem(s). It also works
as a facade, as jsp clients can not create a Hive Session directly. Hive
Sessions are long lived, unlike a traditional Query and Block system clients
set up the query to be started with an instance of this class.
This method scans the SessionItem collection. If a SessionItem is in the
QUERY_SET state that signals that its thread should be started. If the
SessionItem is in the DESTROY state it should be cleaned up and removed
from the collection. Currently we are using a sleep. A wait/notify could be
implemented. Queries will run for a long time, a one second wait on start
will not be noticed.
Here we handle creating the SessionItem, we do this for the JSP client
because we need to set parameters the client is not aware of. One such
parameter is the command line arguments the server was started with.
a - Authenticated user
sessionName - Represents the session name
a new SessionItem or null if a session with that name already