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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

if (request.isCanceled()) {

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

/**
 * When we receive a Confirmable response, we acknowledge it and it also
 * counts as acknowledgment for the request. If the response is a duplicate,
 * we stop it here and do not forward it to the upper layer.
 */
@Override
public void receiveResponse(final Exchange exchange, final Response response) {
  exchange.setFailedTransmissionCount(0);
  exchange.getCurrentRequest().setAcknowledged(true);
  LOGGER.finest("Cancel any retransmission");
  exchange.setRetransmissionHandle(null);
  if (response.getType() == Type.CON && !exchange.getRequest().isCanceled()) {
    LOGGER.finer("Response is confirmable, send ACK");
    EmptyMessage ack = EmptyMessage.newACK(response);
    sendEmptyMessage(exchange, ack);
  }
  if (response.isDuplicate()) {
    LOGGER.fine("Response is duplicate, ignore it");
  } else {
    super.receiveResponse(exchange, response);
  }
}

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

/**
 * When we receive a Confirmable response, we acknowledge it and it also
 * counts as acknowledgment for the request. If the response is a duplicate,
 * we stop it here and do not forward it to the upper layer.
 */
@Override
public void receiveResponse(final Exchange exchange, final Response response) {
  exchange.setFailedTransmissionCount(0);
  exchange.getCurrentRequest().setAcknowledged(true);
  exchange.setRetransmissionHandle(null);
  if (response.getType() == Type.CON && !exchange.getRequest().isCanceled()) {
    LOGGER.finer("acknowledging CON response");
    EmptyMessage ack = EmptyMessage.newACK(response);
    sendEmptyMessage(exchange, ack);
  }
  if (response.isDuplicate()) {
    LOGGER.fine("ignoring duplicate response");
  } else {
    upper().receiveResponse(exchange, response);
  }
}

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

protected final void appendRequestDetails(final Request request) {
  if (request.isCanceled()) {
    buffer.append("CANCELED ");
  }
  buffer.append(request.getType()).append(" [MID=").append(request.getMID())
    .append(", T=").append(request.getTokenString()).append("], ")
    .append(request.getCode()).append(", /").append(request.getOptions().getUriPathString());
  appendBlockOption(1, request.getOptions().getBlock1());
  appendBlockOption(2, request.getOptions().getBlock2());
  appendObserveOption(request.getOptions());
  appendSize1(request.getOptions());
  appendEtags(request.getOptions());
}

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

if (request.isCanceled()) {

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

private void receiveRequest(final Request request, final RawData raw) {
  // set request attributes from raw data
  request.setScheme(raw.isSecure() ? CoAP.COAP_SECURE_URI_SCHEME : CoAP.COAP_URI_SCHEME);
  request.setSenderIdentity(raw.getSenderIdentity());
  /* 
   * Logging here causes significant performance loss.
   * If necessary, add an interceptor that logs the messages,
   * e.g., the MessageTracer.
   */
  for (MessageInterceptor interceptor:interceptors) {
    interceptor.receiveRequest(request);
  }
  // MessageInterceptor might have canceled
  if (!request.isCanceled()) {
    Exchange exchange = matcher.receiveRequest(request);
    if (exchange != null) {
      exchange.setEndpoint(CoapEndpoint.this);
      coapstack.receiveRequest(exchange, request);
    }
  }
}

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

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

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

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

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

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

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

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

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

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

相关文章

微信公众号

最新文章

更多