Slight improvement of ClientHandler constructor.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Improve readability of ClientHandler::setStream().

By extracting the creation of the Streams event listener, the setStream
method becomes better readable.

It also adds a nice separation of responsibilities.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Improve ClientHandler::onClientMessage().

The ::onClientMessage() used an unnecessary elseif, because the previous
if-construction already returns.

Just making it a separate if improves the ease of understanding of this
method.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Improve ClientHandler::onWorkerHandlerMessage().

Some small coding-style changes to ::onWorkerHandlerMessage() to improve
readability.

Mainly changing concatenation of log messages into sprintf()s.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Improve ClientHandler::onWorkerHandlerStatusMessage().

Add an early return in ClientHandler::onWorkerHandlerStatusMessage().

Also a few small CS changes.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
CS changes: ClientHandler::handleWorkerHandlerQueue()

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
CS changes: ClientHandler::hasExpiredWorkerHandler().

Added a little whitespace to improve logical separation withing the
method.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
ClientHandler: don't use storage ArrayAccess API.

By using the ::has() and ::get() methods of the Storage, the code become
slightly better understandable.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Refactor ClientHandler::clientRequest().

Mainly a lot of early returns and some restructuring.

The ExecuteResponse is now sent as soon as the Request Id is known.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Refactor ClientHandler::clientFetch().

Mostly improved log messages and early returns.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Refactor ClientHandler::sendResponseToClients().

The most important part of this change is extracting the poison status
check. That improves readability a lot.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Improve ClientHandler::handleExpiredWorkerHandlers().

Mainly readability improvements, and a better log message.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Add and use Request::get/setWorkerHandlerId().

The functions were called Request::get/setWorker(), but in actuality
these didn't set the worker, but the ID of the Worker Handler.

Made the old functions proxy the new ones, and deprecated them.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Merge pull request #29 from jacobkiers/refactor-client-handler

Refactor ClientHandler.
Bugfix: Client\Request does not have ::hasResult.

The Request::hasResult property does not exits. Instead, it is called
::hasResponse.

Because of this, the result of method Request::hasResponse() is never
'true'. This potenially results in having to request the result over and
over again.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Instantly send result to client if it is available.

If the ClientHandler knows the result for the request that the Client
wants to execute, it now sends it back immediately.

This improves efficiency, but slightly changes the (nondocumented)
contract between the Client and the ClientHandler. It does not change
the actual behaviour of the Client, though.

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
Merge pull request #30 from jacobkiers/instantly-send-result-to-client

Instantly send result to client
Bugfix: A ZMQ message can only contain strings.
Removed internal project name for AlphaRPC.
Import NullLogger.