def exception(self, current): if current.operation == "ice_ids": raise Test.TestIntfUserException() elif current.operation == "requestFailedException": raise Ice.ObjectNotExistException() elif current.operation == "unknownUserException": raise Ice.UnknownUserException("reason") elif current.operation == "unknownLocalException": raise Ice.UnknownLocalException("reason") elif current.operation == "unknownException": raise Ice.UnknownException("reason") elif current.operation == "userException": raise Test.TestIntfUserException() elif current.operation == "localException": raise Ice.SocketException(0) elif current.operation == "pythonException": raise RuntimeError("message") elif current.operation == "unknownExceptionWithServantException": raise Ice.UnknownException("reason") elif current.operation == "impossibleException": raise Test.TestIntfUserException( ) # Yes, it really is meant to be TestIntfUserException. elif current.operation == "intfUserException": raise Test.TestImpossibleException( ) # Yes, it really is meant to be TestImpossibleException. elif current.operation == "asyncResponse": raise Test.TestImpossibleException() elif current.operation == "asyncException": raise Test.TestImpossibleException()
def ice_ping(self, current=None): name = current.id.name if name == "ObjectNotExist": raise Ice.ObjectNotExistException() elif name == "FacetNotExist": raise Ice.FacetNotExistException()
def timestamp(self): self._lock.acquire() try: if self._destroy: raise Ice.ObjectNotExistException() return self._timestamp finally: self._lock.release()
def getName(self, c): self._lock.acquire() try: if self._destroy: raise Ice.ObjectNotExistException() return self._name finally: self._lock.release()
def refresh(self, c): self._lock.acquire() try: if self._destroy: raise Ice.ObjectNotExistException() self._timestamp = time.time() finally: self._lock.release()
def asyncException(self, current=None): # # We can't do this with futures. # #f = Ice.Future() #f.set_exception(Test.TestIntfUserException()) #return f raise Ice.ObjectNotExistException()
def getName(self, current=None): name = current.id.name if name == "ObjectNotExist": raise Ice.ObjectNotExistException() elif name == "FacetNotExist": raise Ice.FacetNotExistException() return name
def createHello(self, current): with self._lock: if self._destroy: raise Ice.ObjectNotExistException() hello = Demo.HelloPrx.uncheckedCast(current.adapter.addWithUUID(HelloI(self._name, self._nextId))) self._nextId = self._nextId + 1 self._objs.append(hello) return hello
def throwEx(t): if t == LocalException: raise Ice.ObjectNotExistException() elif t == UserException: raise Test.TestIntfException() elif t == OtherException: raise RuntimeError() else: test(False)
def createHello(self, c): self._lock.acquire() try: if self._destroy: raise Ice.ObjectNotExistException() hello = Demo.HelloPrx.uncheckedCast( c.adapter.addWithUUID(HelloI(self._name, self._nextId))) self._nextId = self._nextId + 1 self._objs.append(hello) return hello finally: self._lock.release()
def destroy(self, current): with self._lock: if self._destroy: raise Ice.ObjectNotExistException() self._destroy = True print("The session " + self._name + " is now destroyed.") try: current.adapter.remove(current.id) for p in self._objs: current.adapter.remove(p.ice_getIdentity()) except Ice.ObjectAdapterDeactivatedException as ex: # This method is called on shutdown of the server, in # which case this exception is expected. pass self._objs = []
def asyncResponse_async(self, cb, current=None): cb.ice_response() raise Ice.ObjectNotExistException()
def getName(self, current): with self._lock: if self._destroy: raise Ice.ObjectNotExistException() return self._name
def asyncResponse(self, current=None): # # We can't do this with futures. # #return Ice.Future.completed(None) raise Ice.ObjectNotExistException()
def unknownExceptionWithServantException(self, current=None): f = Ice.Future() f.set_exception(Ice.ObjectNotExistException()) return f
def asyncException_async(self, cb, current=None): cb.ice_exception(Test.TestIntfUserException()) raise Ice.ObjectNotExistException()
def unknownExceptionWithServantException(self, current=None): raise Ice.ObjectNotExistException()
def unknownExceptionWithServantException_async(self, cb, current=None): cb.ice_exception(Ice.ObjectNotExistException())