def set_concurrency_options(self, thread_safe=True, handler_thread=True):
        """Set concurrency options for this device server.
        Must be called before :meth:`start`.

        Parameters
        ==========

        thread_safe : bool
            If True, make the server public methods thread safe. Incurs
            performance overhead.
        handler_thread : bool
            Can only be set if `thread_safe` is True. Handle all requests (even
            from different clients) in a separate, single, request-handling
            thread. Blocking request handlers will prevent the server from
            handling new requests from any client, but sensor strategies should
            still function. This more or less mimics the behaviour of a server
            in library versions before 0.6.0.

        """
        if handler_thread:
            assert thread_safe, "handler_thread=True requires thread_safe=True"
        self._server.client_connection_factory = (
            ThreadsafeClientConnection if thread_safe else ClientConnection)
        if handler_thread:
            self._handler_thread = MessageHandlerThread(
                self.handle_message, self.create_log_inform, self._logger)
            self.on_message = self._handler_thread.on_message
        else:
            self.on_message = return_future(self.handle_message)
            self._handler_thread = None

        self._concurrency_options = ObjectDict(
            thread_safe=thread_safe, handler_thread=handler_thread)