简体   繁体   English

Thrift是否具有Java的异步服务器端方法定义?

[英]Does Thrift have async server side method definitions for Java?

I can wire up an HsHaServer and Async client in Java and get it all running swimmingly. 我可以用Java连接一个HsHaServer和Async客户端,让它全部运行起来。 The problem is that there doesn't seem to be an async interface for truly async services. 问题是真正的异步服务似乎没有异步接口。 The service interface is something like 服务界面就像

public TSomeReposonse doStuff( TSomeParams params ); public TSomeReposonse doStuff(TSomeParams params);

which requires me to block inside of doStuff until am ready to return TSomeResponse 这需要我阻止doStuff内部直到准备好返回TSomeResponse

There is an Async.Iface 有一个Async.Iface

public void doStuff( TSomeParams params, AsyncMethodCallback[AsyncClient.doStuff_call] ); public void doStuff(TSomeParams params,AsyncMethodCallback [AsyncClient.doStuff_call]);

but it looks like that is only for the client side. 但它看起来只适用于客户端。 There doesn't seem to be a way to pass a value into the callback. 似乎没有办法将值传递给回调。 Am I right in this? 我是对的吗? If I want true server-side asynchrony do I need to implement my own client/server with something like netty? 如果我想要真正的服务器端异步,我是否需要使用像netty这样的东西实现我自己的客户端/服务器?

Thanks, Andrew 谢谢,安德鲁

This question is pretty old (there's probably a badge for this), but just in case this is relevant to someone, the answer is yes. 这个问题很古老(可能有一个徽章),但是如果这与某人有关,答案是肯定的。 It is called Asynchronous Processing - see here: https://issues.apache.org/jira/browse/THRIFT-1972 它被称为异步处理 - 请参见: https//issues.apache.org/jira/browse/THRIFT-1972

It uses the same interface an async client would use. 它使用异步客户端使用的相同接口。

There is an almost ridiculous lack of documentation about this though. 尽管如此,有一个几乎荒谬的文档缺乏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM