'Starts listening and accepting connection requests.
This method is called when invoking `CallbackServer.start()`. A
CallbackServer instance is created and started automatically when
a :class:`JavaGateway <py4j.java_gateway.JavaGateway>` instance is
created.'

def run(self):

    try:
        with self.lock:
            self.is_shutdown = False
        logger.info(u'Callback    Server    Starting')
        self.server_socket.listen(5)
        logger.info(u'Socket    listening    on    {0}'.format(smart_decode(self.server_socket.getsockname())))
        read_list = [self.server_socket]
        while (not self.is_shutdown):
            (readable, writable, errored) = select.select(read_list, [], [], DEFAULT_CALLBACK_SERVER_ACCEPT_TIMEOUT)
            if self.is_shutdown:
                break
            for s in readable:
                (socket_instance, _) = self.server_socket.accept()
                input = socket_instance.makefile(u'rb', 0)
                connection = CallbackConnection(self.pool, input, socket_instance, self.gateway_client, self.callback_server_parameters)
                with self.lock:
                    if (not self.is_shutdown):
                        self.connections.append(connection)
                        connection.start()
                    else:
                        quiet_shutdown(connection.socket)
                        quiet_close(connection.socket)
    except Exception:
        if self.is_shutdown:
            logger.info(u'Error    while    waiting    for    a    connection.')
        else:
            logger.exception(u'Error    while    waiting    for    a    connection.')
