在没有将消息传递到服务器时,是否有方法来处理这种情况?海豚日志上的情况很清楚,但我想从代码中捕捉到。我正在寻找一些方法,比如: onError来覆盖像onFinished这样的
clientDolphin.send(message, new OnFinishedHandlerAdapter() {
@Override
public void onFinished(List<ClientPresentationModel> presentationModels) {
// Do something useful
}
}
});,但没有这样的事情。此外,在try/catch中包装发送调用也不起作用(因为send没有阻塞其调用方代码),因此不起作用。
我想肯定有一些简单的方法可以让我了解到没有传递的信息,但我看不见。塔克斯,顺便说一句,想要答案!
发布于 2013-10-12 03:37:48
您可以将一个onException处理程序分配给ClientConnector -实际上您应该这样做。异常处理程序将获得在异步发送操作中传递的异常对象。
下面是默认的处理程序,甚至告诉您应该做什么;-)
Closure onException = { Throwable up ->
def out = new StringWriter()
up.printStackTrace(new PrintWriter(out))
log.severe("onException reached, rethrowing in UI Thread, consider setting ClientConnector.onException\n${out.buffer}")
uiThreadHandler.executeInsideUiThread { throw up } // not sure whether this is a good default
}https://stackoverflow.com/questions/19207178
复制相似问题