thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Cox <andrewco...@gmail.com>
Subject Re: onComplete() callback isn't executed using AsyncClient
Date Sat, 11 Aug 2012 18:47:11 GMT
Yes. But the only nonblocking transport implemented is the raw
TNonblockingSocket and your Python server seems to want a framed transport.
So your java client is sending messages without framing (without a message
size before the message) while the python server requires messages with
framing.

You can either change your python server *not* to use framed, or you'll
need to build a framed non-blocking transport.

On Wed, Aug 8, 2012 at 7:01 PM, Drulea, Sherban <
Sherban.Drulea@activision.com> wrote:

> Hey Guys,
>
> On further inspection, the threads executes onError() with the following
> error message:
>
> "java.io.IOException: Read call frame size failed"
>
> My thrift server is Python and my thrift asyncclient is Java initialized
> with TBinaryProtocol.Factory(), TAsyncClientManager(), and
> TNonblockingSocket().
>
> Can Python Thrift servers handle async client calls?
>
> Cheers,
> Sherban
>
> From: <Drulea>, Sherban Drulea <sherban.drulea@activision.com<mailto:
> sherban.drulea@activision.com>>
> Date: Wednesday, August 8, 2012 6:43 PM
> To: "user@thrift.apache.org<mailto:user@thrift.apache.org>" <
> user@thrift.apache.org<mailto:user@thrift.apache.org>>
> Cc: Pierre Schiro <Pierre@codeparticle.com<mailto:Pierre@codeparticle.com
> >>
> Subject: onComplete() callback isn't executed using AsyncClient
>
> Hey Guys,
>
> I wrote an AsyncClient and callback class. The callback's onComplete()
> function, however, is never executed. The execution stack ends after waking
> up the thread that should execute the callback.
>
> public class UserStatsRepository implements IUserStatsRepository,
> InitializingBean {
> …
> / * THIS IS MY CALLBACK IMPLEMENTATION */
> private class _PlayerStatsCallback implements
> AsyncMethodCallback<getPlayerStats_call>{
>         UserStatsRepository userRepo;
>
>         _PlayerStatsCallback( UserStatsRepository userRepo )
>         {
>             this.userRepo = userRepo;
>         }
>
>         @Override
>         public void onComplete(getPlayerStats_call response) {
>             try {
>                 _LOG.error("Calling onComplete with results " +
> response.getResult().toString() );
>                 this.userRepo._playerStats = response.getResult();
>             } catch (ServiceException e) {
>                 // TODO Auto-generated catch block
>                 e.printStackTrace();
>             } catch (TException e) {
>                 // TODO Auto-generated catch block
>                 e.printStackTrace();
>             }
>         }
>
>         @Override
>         public void onError(Exception exception) {
>             // TODO Auto-generated method stub
>             exception.printStackTrace();
>         };
>     }
> …
> public UserStatsModel getUserStats(String userCompactDwid) throws
> BeachheadException {
>        …
>         / * This instantiates an ASyncClient with
> TBinaryProtocol.Factory(), TAsyncClientManager(), and TNonblockingSocket()
> */
>         PlayerStatsAPI.AsyncClient client = _asynchPool.borrow();
>         _PlayerStatsCallback callback = new _PlayerStatsCallback(this);
>
>         try {
>             …
>             PlayerStatsParams params = new PlayerStatsParams();
>             …
>
>             client.getPlayerStats(params, callback);
>
>         } catch (Exception e) {
>             _LOG.error("Exception thrown while attempting to retrieve user
> stats: ", e);
>
>         } finally {
>             _asynchPool.release(client);
>         }
>         return
> getUserStatsInternal(callback.userRepo._playerStats.getStats(), dwidm);
>     }
>
>  1.  Start with client.getPlayerStats(params, callback);
>  2.  Goes to auto-generated getPlayerStatsCode() function AsyncCLient
>  code :
>
> public void getPlayerStats(PlayerStatsParams params,
> org.apache.thrift.async.AsyncMethodCallback<getPlayerStats_call>
> resultHandler) throws org.apache.thrift.TException {
>       checkReady(); getPlayerStats_call method_call = new
> getPlayerStats_call(params, resultHandler, this, ___protocolFactory,
> ___transport); this.___currentMethod = method_call;
> ___manager.call(method_call); }
> 3. Makes it ___manager.call(method_call);
> 4. Goes to TAsyncClientManage.call()
>         5. Makes it to selectThread.getSelector().wakeup();
>         6. Exits! _PlayerStatsCallback.onComplete() is never called!
>
> Any ideas why onComplete() isn't executed?
>
> Cheers,
> Sherban
>
>  1.
>
> Cheers,
> Sherban
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message