本文整理了Java中org.eclipse.californium.core.coap.Request.cancel
方法的一些代码示例,展示了Request.cancel
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.cancel
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:cancel
暂无
代码示例来源:origin: org.eclipse.leshan/leshan-server-cf
@Override
public void cancel() {
coapRequest.cancel();
}
代码示例来源:origin: eclipse/leshan
@Override
public void run() {
responseTimedOut.set(true);
coapRequest.cancel();
}
}, timeoutInMs, TimeUnit.MILLISECONDS);
代码示例来源:origin: eclipse/californium
/**
* Cancel observer.
*/
private void cancel() {
Request request = this.request;
request.cancel();
setCanceled(true);
}
代码示例来源:origin: eclipse/leshan
public Response waitForCoapResponse() throws InterruptedException {
try {
boolean timeElapsed = false;
timeElapsed = !latch.await(timeout, TimeUnit.MILLISECONDS);
if (timeElapsed || coapTimeout.get()) {
coapRequest.cancel();
}
} finally {
coapRequest.removeMessageObserver(this);
}
if (exception.get() != null) {
coapRequest.cancel();
throw exception.get();
}
return ref.get();
}
}
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Cancel observer.
*/
private void cancel() {
Request request = this.request;
request.cancel();
setCanceled(true);
}
代码示例来源:origin: eclipse/californium
@Override
public void receiveRequest(Request received) {
counter.getAndIncrement();
if (cancelRequest) {
request.cancel();
}
}
};
代码示例来源:origin: org.github.leshan/leshan-client
public OperationResponse waitForResponse() {
try {
final boolean latchTimeout = latch.await(timeout, TimeUnit.MILLISECONDS);
if (!latchTimeout || coapTimeout.get()) {
coapRequest.cancel();
if (exception.get() != null) {
throw exception.get();
} else {
throw new RuntimeException("Request Timed Out: " + coapRequest.getURI() + " (timeout)");
}
}
} catch (final InterruptedException e) {
// no idea why some other thread should have interrupted this thread
// but anyway, go ahead as if the timeout had been reached
LOG.info("Caught an unexpected InterruptedException during execution of CoAP request " + e);
} finally {
coapRequest.removeMessageObserver(this);
}
if (exception.get() != null) {
throw exception.get();
}
return ref.get();
}
}
代码示例来源:origin: org.eclipse.leshan/leshan-client
public OperationResponse waitForResponse() {
try {
final boolean latchTimeout = latch.await(timeout, TimeUnit.MILLISECONDS);
if (!latchTimeout || coapTimeout.get()) {
coapRequest.cancel();
if (exception.get() != null) {
throw exception.get();
} else {
throw new RuntimeException("Request Timed Out: " + coapRequest.getURI() + " (timeout)");
}
}
} catch (final InterruptedException e) {
// no idea why some other thread should have interrupted this thread
// but anyway, go ahead as if the timeout had been reached
LOG.info("Caught an unexpected InterruptedException during execution of CoAP request " + e);
} finally {
coapRequest.removeMessageObserver(this);
}
if (exception.get() != null) {
throw exception.get();
}
return ref.get();
}
}
代码示例来源:origin: org.eclipse.leshan/leshan-server-cf
public T waitForResponse() {
try {
final boolean latchTimeout = latch.await(timeout, TimeUnit.MILLISECONDS);
if (!latchTimeout || coapTimeout.get()) {
clientRegistry.deregisterClient(client.getRegistrationId());
coapRequest.cancel();
if (exception.get() != null) {
throw exception.get();
} else {
throw new RequestTimeoutException(coapRequest.getURI(), timeout);
}
}
} catch (final InterruptedException e) {
// no idea why some other thread should have interrupted this thread
// but anyway, go ahead as if the timeout had been reached
LOG.debug("Caught an unexpected InterruptedException during execution of CoAP request", e);
} finally {
coapRequest.removeMessageObserver(this);
}
if (exception.get() != null) {
throw exception.get();
}
return ref.get();
}
}
代码示例来源:origin: eclipse/leshan
@Override
public void cancelPendingRequests(Registration registration) {
Validate.notNull(registration);
String registrationId = registration.getId();
SortedMap<String, Request> requests = pendingRequests.subMap(getFloorKey(registrationId),
getCeilingKey(registrationId));
for (Request coapRequest : requests.values()) {
coapRequest.cancel();
}
requests.clear();
}
代码示例来源:origin: eclipse/californium
private CoapResponse synchronous(Request request, Endpoint outEndpoint) {
try {
Response response = send(request, outEndpoint).waitForResponse(getTimeout());
if (response == null) {
// Cancel request so appropriate clean up can happen.
request.cancel();
return null;
} else {
return new CoapResponse(response);
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: eclipse/californium
request.cancel(); // stack should send RST
代码示例来源:origin: eclipse/californium
request.cancel();
代码示例来源:origin: eclipse/californium
exchange.getRequest().cancel();
return;
exchange.getRequest().cancel();
return;
代码示例来源:origin: eclipse/californium
request.cancel();
server.sendResponse(ACK, CONTENT).loadBoth("B").block2(1, true, 16).payload(respPayload.substring(16, 32)).go();
内容来源于网络,如有侵权,请联系作者删除!