org.eclipse.californium.core.coap.Request.isCanceled()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中org.eclipse.californium.core.coap.Request.isCanceled方法的一些代码示例,展示了Request.isCanceled的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.isCanceled方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:isCanceled

Request.isCanceled介绍

暂无

代码示例

代码示例来源:origin: eclipse/californium

  1. long leftTimeout = timeout;
  2. synchronized (this) {
  3. while (this.response == null && !isCanceled() && !isTimedOut() && !isRejected()) {
  4. wait(leftTimeout);
  5. long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());

代码示例来源:origin: org.eclipse.californium/californium-core

  1. long leftTimeout = timeout;
  2. synchronized (this) {
  3. while (this.response == null && !isCanceled() && !isTimedOut() && !isRejected()) {
  4. wait(leftTimeout);
  5. long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());

代码示例来源:origin: eclipse/californium

  1. @Override
  2. public void receiveResponse(final Exchange exchange, final Response response) {
  3. if (response.getOptions().hasObserve() && exchange.getRequest().isCanceled()) {
  4. // The request was canceled and we no longer want notifications
  5. LOGGER.finer("Ignore notification for canceled TCP Exchange");
  6. } else {
  7. // No observe option in response => always deliver
  8. upper().receiveResponse(exchange, response);
  9. }
  10. }
  11. }

代码示例来源:origin: org.eclipse.californium/californium-core

  1. @Override
  2. public void receiveResponse(Exchange exchange, Response response) {
  3. if (response.getOptions().hasObserve() && exchange.getRequest().isCanceled()) {
  4. // The request was canceled and we no longer want notifications
  5. LOGGER.finer("Rejecting notification for canceled Exchange");
  6. EmptyMessage rst = EmptyMessage.newRST(response);
  7. sendEmptyMessage(exchange, rst);
  8. // Matcher sets exchange as complete when RST is sent
  9. } else {
  10. // No observe option in response => always deliver
  11. super.receiveResponse(exchange, response);
  12. }
  13. }

代码示例来源:origin: eclipse/californium

  1. @Override
  2. public void receiveResponse(final Exchange exchange, final Response response) {
  3. if (response.getOptions().hasObserve() && exchange.getRequest().isCanceled()) {
  4. // The request was canceled and we no longer want notifications
  5. LOGGER.finer("Rejecting notification for canceled Exchange");
  6. EmptyMessage rst = EmptyMessage.newRST(response);
  7. sendEmptyMessage(exchange, rst);
  8. // Matcher sets exchange as complete when RST is sent
  9. } else {
  10. // No observe option in response => always deliver
  11. upper().receiveResponse(exchange, response);
  12. }
  13. }

代码示例来源:origin: org.eclipse.californium/californium-core

  1. if (request.isCanceled()) {

代码示例来源:origin: org.eclipse.californium/californium-core

  1. /**
  2. * When we receive a Confirmable response, we acknowledge it and it also
  3. * counts as acknowledgment for the request. If the response is a duplicate,
  4. * we stop it here and do not forward it to the upper layer.
  5. */
  6. @Override
  7. public void receiveResponse(final Exchange exchange, final Response response) {
  8. exchange.setFailedTransmissionCount(0);
  9. exchange.getCurrentRequest().setAcknowledged(true);
  10. LOGGER.finest("Cancel any retransmission");
  11. exchange.setRetransmissionHandle(null);
  12. if (response.getType() == Type.CON && !exchange.getRequest().isCanceled()) {
  13. LOGGER.finer("Response is confirmable, send ACK");
  14. EmptyMessage ack = EmptyMessage.newACK(response);
  15. sendEmptyMessage(exchange, ack);
  16. }
  17. if (response.isDuplicate()) {
  18. LOGGER.fine("Response is duplicate, ignore it");
  19. } else {
  20. super.receiveResponse(exchange, response);
  21. }
  22. }

代码示例来源:origin: eclipse/californium

  1. /**
  2. * When we receive a Confirmable response, we acknowledge it and it also
  3. * counts as acknowledgment for the request. If the response is a duplicate,
  4. * we stop it here and do not forward it to the upper layer.
  5. */
  6. @Override
  7. public void receiveResponse(final Exchange exchange, final Response response) {
  8. exchange.setFailedTransmissionCount(0);
  9. exchange.getCurrentRequest().setAcknowledged(true);
  10. exchange.setRetransmissionHandle(null);
  11. if (response.getType() == Type.CON && !exchange.getRequest().isCanceled()) {
  12. LOGGER.finer("acknowledging CON response");
  13. EmptyMessage ack = EmptyMessage.newACK(response);
  14. sendEmptyMessage(exchange, ack);
  15. }
  16. if (response.isDuplicate()) {
  17. LOGGER.fine("ignoring duplicate response");
  18. } else {
  19. upper().receiveResponse(exchange, response);
  20. }
  21. }

代码示例来源:origin: eclipse/californium

  1. protected final void appendRequestDetails(final Request request) {
  2. if (request.isCanceled()) {
  3. buffer.append("CANCELED ");
  4. }
  5. buffer.append(request.getType()).append(" [MID=").append(request.getMID())
  6. .append(", T=").append(request.getTokenString()).append("], ")
  7. .append(request.getCode()).append(", /").append(request.getOptions().getUriPathString());
  8. appendBlockOption(1, request.getOptions().getBlock1());
  9. appendBlockOption(2, request.getOptions().getBlock2());
  10. appendObserveOption(request.getOptions());
  11. appendSize1(request.getOptions());
  12. appendEtags(request.getOptions());
  13. }

代码示例来源:origin: eclipse/californium

  1. if (request.isCanceled()) {

代码示例来源:origin: eclipse/californium

  1. private void receiveRequest(final Request request, final RawData raw) {
  2. // set request attributes from raw data
  3. request.setScheme(raw.isSecure() ? CoAP.COAP_SECURE_URI_SCHEME : CoAP.COAP_URI_SCHEME);
  4. request.setSenderIdentity(raw.getSenderIdentity());
  5. /*
  6. * Logging here causes significant performance loss.
  7. * If necessary, add an interceptor that logs the messages,
  8. * e.g., the MessageTracer.
  9. */
  10. for (MessageInterceptor interceptor:interceptors) {
  11. interceptor.receiveRequest(request);
  12. }
  13. // MessageInterceptor might have canceled
  14. if (!request.isCanceled()) {
  15. Exchange exchange = matcher.receiveRequest(request);
  16. if (exchange != null) {
  17. exchange.setEndpoint(CoapEndpoint.this);
  18. coapstack.receiveRequest(exchange, request);
  19. }
  20. }
  21. }

代码示例来源:origin: eclipse/californium

  1. if (request.isCanceled()) {
  2. throw new IllegalStateException("observe request already canceled! token " + request.getTokenString());

代码示例来源:origin: org.eclipse.californium/californium-core

  1. if (request.isCanceled()) {
  2. throw new IllegalStateException("observe request already canceled! token " + request.getTokenString());

代码示例来源:origin: eclipse/californium

  1. public void receiveResponse(final Exchange exchange, final Response response) {
  2. if (exchange.getRequest().isCanceled()) {

代码示例来源:origin: org.eclipse.californium/californium-core

  1. if (!request.isCanceled()) {
  2. Exchange exchange = matcher.receiveRequest(request);
  3. if (exchange != null) {

代码示例来源:origin: org.eclipse.californium/californium-core

  1. if (exchange.getRequest().isCanceled()) {

相关文章