AsyncRecallResult
异步撤回结果.
可由 MessageSource.recallIn 返回得到.
用法
获取撤回失败时的异常
val exception = result.exception.await() // 挂起协程并等待撤回的结果.
if (exception == null) {
// 撤回成功
} else {
// 撤回失败
}Content copied to clipboard
若仅需要了解撤回是否成功而不需要获取详细异常实例, 可使用 isSuccess
异步撤回结果.
可由 MessageSource.recallIn 返回得到.
Kotlin 用法示例
获取撤回失败时的异常
val exception = result.exception.await() // 挂起协程并等待撤回的结果.
if (exception == null) {
// 撤回成功
} else {
// 撤回失败
}Content copied to clipboard
若仅需要了解撤回是否成功而不需要获取详细异常实例, 可使用 isSuccess
Java 用法示例
Throwable exception = result.exceptionFuture.get(); // 阻塞线程并等待撤回的结果.
if (exception == null) {
// 撤回成功
} else {
// 撤回失败
}Content copied to clipboard
异步撤回结果.
可由 MessageSource.recallIn 返回得到.
用法
获取撤回失败时的异常
val exception = result.exception.await() // 挂起协程并等待撤回的结果.
if (exception == null) {
// 撤回成功
} else {
// 撤回失败
}Content copied to clipboard
若仅需要了解撤回是否成功而不需要获取详细异常实例, 可使用 isSuccess
See also
Functions
Link copied to clipboard
挂起协程直到撤回完成, 返回撤回时产生的异常. 当撤回成功时返回 null.
挂起协程 (在 Java 为阻塞线程) 直到撤回完成, 返回撤回时产生的异常. 当撤回成功时返回 null.
挂起协程直到撤回完成, 返回撤回时产生的异常. 当撤回成功时返回 null.
Link copied to clipboard
挂起协程直到撤回完成, 返回撤回的结果.
挂起协程 (在 Java 为阻塞线程) 直到撤回完成, 返回撤回的结果.
挂起协程直到撤回完成, 返回撤回的结果.
Properties
Link copied to clipboard
Link copied to clipboard
撤回时产生的异常, 当撤回成功时为 null. Java CompletableFuture API.
Link copied to clipboard
撤回是否成功. Java CompletableFuture API.