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 <[email protected]<mailto:[email protected]>> Date: Wednesday, August 8, 2012 6:43 PM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Cc: Pierre Schiro <[email protected]<mailto:[email protected]>> 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
