def load(self, db, extender):
        def loadRequestResponse(index, callbacks, helpers, host, port, protocol, requestData):
            # NOTE: tempRequestResponse is an array because of a threading issue,
            # where if this thread times out, it will still update temprequestresponse later on..
            # TODO: also this still locks the UI until all requests suceed or time out...
            try:
                # Due to Burp Extension API, must create a original request for all messages
                service = helpers.buildHttpService(host, port, protocol)
                if service:
                    self.tempRequestResponse[index] = callbacks.makeHttpRequest(service,requestData)
            except java.lang.RuntimeException:
                # Catches if there is a bad host
                # TODO there is an unhandled exception thrown in the stack trace here?
                return
            except:
                traceback.print_exc(file=callbacks.getStderr())

        def replaceDomain(requestData, oldDomain, newDomain):
            reqstr = StringUtil.fromBytes(requestData)
            reqstr = reqstr.replace(oldDomain, newDomain)
            newreq = StringUtil.toBytes(reqstr)
            return newreq

        callbacks = extender._callbacks
        helpers = extender._helpers

        self.lock.acquire()
        self.arrayOfRoles = db.arrayOfRoles
        self.arrayOfUsers = db.arrayOfUsers
        self.deletedUserCount = db.deletedUserCount
        self.deletedRoleCount = db.deletedRoleCount
        self.deletedMessageCount = db.deletedMessageCount
        self.arrayOfMessages = ArrayList()

        self.tempRequestResponse = []
        index=0
        newDomain = None
        replaceForAll = False
        skipped = 0
        for message in db.arrayOfMessages: 
            keeptrying = True
            while keeptrying:
                self.tempRequestResponse.append(None)

                if newDomain:
                    requestData = replaceDomain(message._requestData, message._host, newDomain)
                    host = newDomain
                    # TODO consider changing port too?
                else:
                    requestData = message._requestData
                    host = message._host

                t = Thread(target=loadRequestResponse, args = [index, callbacks, helpers, host, message._port, message._protocol, requestData])
                t.start()
                t.join(self.LOAD_TIMEOUT)
                if not t.isAlive() and self.tempRequestResponse[index] != None:
                    self.arrayOfMessages.add(MessageEntry(
                        message._index,
                        message._tableRow-skipped,
                        callbacks.saveBuffersToTempFiles(self.tempRequestResponse[index]),
                        message._url, message._name, message._roles, message._successRegex, message._deleted))
                    keeptrying = False
                    if not replaceForAll:
                        newDomain = None
                else:
                    keeptrying, newDomain, replaceForAll = extender.changeDomainPopup(host, message._tableRow)
                    if not keeptrying:
                        skipped += 1
                    
                index += 1

        self.lock.release()
dataset/ETHPy150Open SecurityInnovation/AuthMatrix/AuthMatrix.py/MatrixDB.load/original