def proxyProcessRequest(self, theRequest, receptionTime): """ generated source for method proxyProcessRequest """ startSleeping = System.currentTimeMillis() timeToFinish = receptionTime timeToSleep = 0L try: if isinstance(theRequest, (PlayRequest, )): if self.theDefaultGamer.getMatch() != None: timeToFinish = receptionTime + self.theDefaultGamer.getMatch().getPlayClock() * 1000 - self.PLAY_BUFFER else: timeToFinish = System.currentTimeMillis() timeToSleep = timeToFinish - System.currentTimeMillis() if timeToSleep > 0: Thread.sleep(timeToSleep) elif isinstance(theRequest, (StartRequest, )): GamerLogger.startFileLogging(self.theDefaultGamer.getMatch(), self.theDefaultGamer.getRoleName().__str__()) print "Started playing " + self.theDefaultGamer.getMatch().getMatchId() + "." timeToFinish = receptionTime + self.theDefaultGamer.getMatch().getStartClock() * 1000 - self.METAGAME_BUFFER timeToSleep = timeToFinish - System.currentTimeMillis() if timeToSleep > 0: Thread.sleep(timeToSleep) elif isinstance(theRequest, (StopRequest, )) or isinstance(theRequest, (AbortRequest, )): GamerLogger.stopFileLogging() self.needRestart = True except InterruptedException as ie: GamerLogger.log("Proxy", "[PROXY] Got woken up by final move!") GamerLogger.log("Proxy", "[PROXY] Proxy slept for " + (System.currentTimeMillis() - startSleeping) + ", and woke up " + (System.currentTimeMillis() - timeToFinish) + "ms late (started " + (startSleeping - receptionTime) + "ms after receiving message).")