コード例 #1
0
ファイル: TestService.py プロジェクト: Patrick-Park/fbthrift
      result.success = self._handler.future_isPrime(args.num).result()
    except:
      ex = sys.exc_info()[1]
      self._event_handler.handlerError(handler_ctx, 'isPrime', ex)
      result = Thrift.TApplicationException(message=str(ex))
    return result

  @future_process_method(isPrime_args, oneway=False)
  def future_process_isPrime(self, args, handler_ctx):
    return self._executor.submit(self.then_isPrime, args, handler_ctx)

  def then_getResult(self, args, handler_ctx):
    result = getResult_result()
    try:
      result.success = self._handler.future_getResult().result()
    except:
      ex = sys.exc_info()[1]
      self._event_handler.handlerError(handler_ctx, 'getResult', ex)
      result = Thrift.TApplicationException(message=str(ex))
    return result

  @future_process_method(getResult_args, oneway=False)
  def future_process_getResult(self, args, handler_ctx):
    return self._executor.submit(self.then_getResult, args, handler_ctx)

Iface._processor_type = Processor

fix_spec(all_structs)
del all_structs

コード例 #2
0
        True,
        None,
        2,
    ),  # 1
)

CustomException.thrift_struct_annotations = {}
CustomException.thrift_field_annotations = {}


def CustomException__init__(
    self,
    message=None,
):
    self.message = message


CustomException.__init__ = CustomException__init__


def CustomException__setstate__(self, state):
    state.setdefault('message', None)
    self.__dict__ = state


CustomException.__getstate__ = lambda self: self.__dict__.copy()
CustomException.__setstate__ = CustomException__setstate__

fix_spec(all_structs)
del all_structs