本文整理了Java中org.eclipse.californium.core.coap.Request.removeMessageObserver
方法的一些代码示例,展示了Request.removeMessageObserver
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.removeMessageObserver
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:removeMessageObserver
暂无
代码示例来源:origin: eclipse/leshan
@Override
public void onResponse(Response coapResponse) {
LOG.debug("Received coap response: {} for {}", coapResponse, coapRequest);
try {
cleaningTask.cancel(false);
responseCallback.onResponse(coapResponse);
} catch (Exception e) {
errorCallback.onError(e);
} finally {
coapRequest.removeMessageObserver(this);
}
}
代码示例来源: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.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.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-server-cf
@Override
public void onResponse(final Response coapResponse) {
LOG.debug("Received coap response: {}", coapResponse);
try {
final T lwM2mResponseT = buildResponse(coapResponse);
if (lwM2mResponseT != null) {
responseCallback.accept(lwM2mResponseT);
}
} catch (final ResourceAccessException e) {
errorCallback.accept(e);
} finally {
coapRequest.removeMessageObserver(this);
}
}
代码示例来源: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: org.eclipse.leshan/leshan-client
@Override
public void onResponse(final Response coapResponse) {
try {
final OperationResponse lwM2mResponseT = buildResponse(coapResponse);
if (lwM2mResponseT != null) {
responseCallback.onSuccess(lwM2mResponseT);
}
} catch (final Exception e) {
responseCallback.onFailure(OperationResponse.failure(ResponseCode.INTERNAL_SERVER_ERROR,
e.getLocalizedMessage()));
} finally {
coapRequest.removeMessageObserver(this);
}
}
代码示例来源:origin: org.github.leshan/leshan-client
@Override
public void onResponse(final Response coapResponse) {
try {
final OperationResponse lwM2mResponseT = buildResponse(coapResponse);
if (lwM2mResponseT != null) {
responseCallback.onSuccess(lwM2mResponseT);
}
} catch (final Exception e) {
responseCallback.onFailure(OperationResponse.failure(ResponseCode.INTERNAL_SERVER_ERROR,
e.getLocalizedMessage()));
} finally {
coapRequest.removeMessageObserver(this);
}
}
代码示例来源:origin: org.eclipse.californium/californium-core
request.removeMessageObserver(mo);
refresh.addMessageObserver(mo);
代码示例来源:origin: eclipse/californium
request.removeMessageObserver(mo);
refresh.addMessageObserver(mo);
内容来源于网络,如有侵权,请联系作者删除!