本文整理了Java中org.web3j.protocol.core.Request.getId
方法的一些代码示例,展示了Request.getId
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getId
方法的具体详情如下:
包路径:org.web3j.protocol.core.Request
类名称:Request
方法名:getId
暂无
代码示例来源:origin: web3j/web3j
private <T extends Notification<?>> void subscribeToEventsStream(
Request request,
BehaviorSubject<T> subject, Class<T> responseType) {
subscriptionRequestForId.put(
request.getId(),
new WebSocketSubscription<>(subject, responseType));
try {
send(request, EthSubscribe.class);
} catch (IOException e) {
log.error("Failed to subscribe to RPC events with request id {}",
request.getId());
subject.onError(e);
}
}
代码示例来源:origin: web3j/web3j
@Override
public <T extends Response> CompletableFuture<T> sendAsync(
Request request,
Class<T> responseType) {
CompletableFuture<T> result = new CompletableFuture<>();
long requestId = request.getId();
requestForId.put(requestId, new WebSocketRequest<>(result, responseType));
try {
sendRequest(request, requestId);
} catch (IOException e) {
closeRequest(requestId, e);
}
return result;
}
代码示例来源:origin: web3j/web3j
@Test
public void testWaitingForReplyToSentRequest() throws Exception {
service.sendAsync(request, Web3ClientVersion.class);
assertTrue(service.isWaitingForReply(request.getId()));
}
内容来源于网络,如有侵权,请联系作者删除!