• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AckHandle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.ipc.invalidation.external.client.types.AckHandle的典型用法代码示例。如果您正苦于以下问题:Java AckHandle类的具体用法?Java AckHandle怎么用?Java AckHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AckHandle类属于com.google.ipc.invalidation.external.client.types包,在下文中一共展示了AckHandle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onInvalidateUpcall

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
/**
 * Handles an invalidation-related listener {@code upcall} by dispatching to the appropriate
 * method on an instance of {@link InvalidationListener}.
 */
private void onInvalidateUpcall(InvalidateUpcall invalidate, InvalidationListener listener) {
  AckHandle ackHandle = AckHandle.newInstance(invalidate.getAckHandle().getByteArray());
  if (invalidate.getNullableInvalidation() != null) {
    listener.invalidate(client,
        ProtoWrapperConverter.convertFromInvalidationProto(invalidate.getNullableInvalidation()),
        ackHandle);
  } else if (invalidate.hasInvalidateAll()) {
    listener.invalidateAll(client, ackHandle);
  } else if (invalidate.getNullableInvalidateUnknown() != null) {
    listener.invalidateUnknownVersion(client,
        ProtoWrapperConverter.convertFromObjectIdProto(invalidate.getNullableInvalidateUnknown()),
        ackHandle);
  } else {
    throw new RuntimeException("Invalid invalidate upcall: " + invalidate);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:AndroidInvalidationListenerIntentMapper.java


示例2: onInvalidateUpcall

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
/**
 * Handles an invalidation-related listener {@code upcall} by dispatching to the appropriate
 * method on an instance of {@link #listenerClass}.
 */
private void onInvalidateUpcall(ListenerUpcall upcall, InvalidationListener listener) {
  InvalidateUpcall invalidate = upcall.getInvalidate();
  AckHandle ackHandle = AckHandle.newInstance(invalidate.getAckHandle().toByteArray());
  if (invalidate.hasInvalidation()) {
    listener.invalidate(client,
        ProtoConverter.convertFromInvalidationProto(invalidate.getInvalidation()),
        ackHandle);
  } else if (invalidate.hasInvalidateAll()) {
    listener.invalidateAll(client, ackHandle);
  } else if (invalidate.hasInvalidateUnknown()) {
    listener.invalidateUnknownVersion(client,
        ProtoConverter.convertFromObjectIdProto(invalidate.getInvalidateUnknown()), ackHandle);
  } else {
    throw new RuntimeException("Invalid invalidate upcall: " + invalidate);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:AndroidInvalidationListenerIntentMapper.java


示例3: invalidate

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidate(InvalidationClient client, Invalidation invalidation,
    AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateIntent(
        ProtoWrapperConverter.convertToInvalidationProto(invalidation), ackHandleP));
  } catch (ValidationException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidate", ackHandle);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:AndroidInvalidationClientImpl.java


示例4: invalidateUnknownVersion

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateUnknownVersion(InvalidationClient client, ObjectId objectId,
    AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateUnknownIntent(
        ProtoWrapperConverter.convertToObjectIdProto(objectId), ackHandleP));
  } catch (ValidationException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidateUnknownVersion", ackHandle);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:AndroidInvalidationClientImpl.java


示例5: invalidateAll

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateAll(InvalidationClient client, AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateAllIntent(ackHandleP));
  } catch (ValidationException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidateAll", ackHandle);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:11,代码来源:AndroidInvalidationClientImpl.java


示例6: acknowledge

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override  // InvalidationClient
public void acknowledge(final AckHandle acknowledgeHandle) {
  Preconditions.checkNotNull(acknowledgeHandle);
  Preconditions.checkState(internalScheduler.isRunningOnThread(),
      "Not running on internal thread");

  // Parse and validate the ack handle first.
  AckHandleP ackHandle;
  try {
    ackHandle = AckHandleP.parseFrom(acknowledgeHandle.getHandleData());
  } catch (ValidationException exception) {
    logger.warning("Bad ack handle : %s",
        Bytes.toLazyCompactString(acknowledgeHandle.getHandleData()));
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // Currently, only invalidations have non-trivial ack handle.
  InvalidationP invalidation = ackHandle.getNullableInvalidation();
  if (invalidation == null) {
    logger.warning("Ack handle without invalidation : %s",
        Bytes.toLazyCompactString(acknowledgeHandle.getHandleData()));
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // Don't send the payload back.
  if (invalidation.hasPayload()) {
    InvalidationP.Builder builder = invalidation.toBuilder();
    builder.payload = null;
    invalidation = builder.build();
  }
  statistics.recordIncomingOperation(IncomingOperationType.ACKNOWLEDGE);
  protocolHandler.sendInvalidationAck(invalidation, batchingTask);

  // Record that the invalidation has been acknowledged to potentially avoid unnecessary delivery
  // of earlier invalidations for the same object.
  ackCache.recordAck(invalidation);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:40,代码来源:InvalidationClientCore.java


示例7: handleInvalidations

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
/** Handles incoming {@code invalidations}. */
private void handleInvalidations(Collection<InvalidationP> invalidations) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");

  for (InvalidationP invalidation : invalidations) {
    AckHandle ackHandle = AckHandle.newInstance(AckHandleP.create(invalidation).toByteArray());
    if (ackCache.isAcked(invalidation)) {
      // If the ack cache indicates that the client has already acked a restarted invalidation
      // with an equal or greater version, then the TICL can simply acknowledge it immediately
      // rather than delivering it to the listener.
      logger.info("Stale invalidation {0}, not delivering", invalidation);
      acknowledge(ackHandle);
      statistics.recordReceivedMessage(ReceivedMessageType.STALE_INVALIDATION);
    } else if (CommonProtos.isAllObjectId(invalidation.getObjectId())) {
      logger.info("Issuing invalidate all");
      listener.invalidateAll(InvalidationClientCore.this, ackHandle);
    } else {
      // Regular object. Could be unknown version or not.
      Invalidation inv = ProtoWrapperConverter.convertFromInvalidationProto(invalidation);

      boolean isSuppressed = invalidation.getIsTrickleRestart();
      logger.info("Issuing invalidate (known-version = %s, is-trickle-restart = %s): %s",
          invalidation.getIsKnownVersion(), isSuppressed, inv);

      // Issue invalidate if the invalidation had a known version AND either no suppression has
      // occurred or the client allows suppression.
      if (invalidation.getIsKnownVersion() &&
          (!isSuppressed || InvalidationClientCore.this.config.getAllowSuppression())) {
        listener.invalidate(InvalidationClientCore.this, inv, ackHandle);
      } else {
        // Otherwise issue invalidateUnknownVersion.
        listener.invalidateUnknownVersion(InvalidationClientCore.this, inv.getObjectId(),
            ackHandle);
      }
    }
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:38,代码来源:InvalidationClientCore.java


示例8: invalidate

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidate(final InvalidationClient client, final Invalidation invalidation,
    final AckHandle ackHandle) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
  Preconditions.checkNotNull(ackHandle);
  listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.invalidate") {
    @Override
    public void run() {
      statistics.recordListenerEvent(ListenerEventType.INVALIDATE);
      delegate.invalidate(client, invalidation, ackHandle);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:14,代码来源:CheckingInvalidationListener.java


示例9: invalidateUnknownVersion

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateUnknownVersion(final InvalidationClient client, final ObjectId objectId,
    final AckHandle ackHandle) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
  Preconditions.checkNotNull(ackHandle);
  listenerScheduler.schedule(NO_DELAY,
      new NamedRunnable("CheckingInvalListener.invalidateUnknownVersion") {
    @Override
    public void run() {
      statistics.recordListenerEvent(ListenerEventType.INVALIDATE_UNKNOWN);
      delegate.invalidateUnknownVersion(client, objectId, ackHandle);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:CheckingInvalidationListener.java


示例10: invalidateAll

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateAll(final InvalidationClient client, final AckHandle ackHandle) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
  Preconditions.checkNotNull(ackHandle);
  listenerScheduler.schedule(NO_DELAY, new NamedRunnable("CheckingInvalListener.invalidateAll") {
    @Override
    public void run() {
      statistics.recordListenerEvent(ListenerEventType.INVALIDATE_ALL);
      delegate.invalidateAll(client, ackHandle);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:CheckingInvalidationListener.java


示例11: acknowledge

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void acknowledge(final AckHandle ackHandle) {
  getResources().getInternalScheduler().schedule(NO_DELAY, new Runnable() {
    @Override
    public void run() {
      InvalidationClientImpl.super.acknowledge(ackHandle);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:InvalidationClientImpl.java


示例12: tryHandleAckIntent

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
/** Tries to handle an ack intent. Returns {@code true} iff the intent is an ack intent. */
private boolean tryHandleAckIntent(Intent intent) {
  byte[] data = AndroidListenerIntents.findAckHandle(intent);
  if (data == null) {
    return false;
  }
  getClient().acknowledge(AckHandle.newInstance(data));
  return true;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:AndroidListener.java


示例13: invalidate

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidate(InvalidationClient client, Invalidation invalidation,
    AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateIntent(
        ProtoConverter.convertToInvalidationProto(invalidation), ackHandleP));
  } catch (InvalidProtocolBufferException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidate", ackHandle);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:AndroidInvalidationClientImpl.java


示例14: invalidateUnknownVersion

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateUnknownVersion(InvalidationClient client, ObjectId objectId,
    AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateUnknownIntent(
        ProtoConverter.convertToObjectIdProto(objectId), ackHandleP));
  } catch (InvalidProtocolBufferException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidateUnknownVersion", ackHandle);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:AndroidInvalidationClientImpl.java


示例15: invalidateAll

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidateAll(InvalidationClient client, AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(context, ListenerUpcalls.newInvalidateAllIntent(ackHandleP));
  } catch (InvalidProtocolBufferException exception) {
    // Log and drop invalid call.
    logBadAckHandle("invalidateAll", ackHandle);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:AndroidInvalidationClientImpl.java


示例16: acknowledge

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void acknowledge(AckHandle ackHandle) {
  try {
    AckHandleP ackHandleP = AckHandleP.parseFrom(ackHandle.getHandleData());
    issueIntent(ClientDowncalls.newAcknowledgeIntent(ackHandleP));
  } catch (InvalidProtocolBufferException exception) {
    logger.warning("Dropping acknowledge(); could not parse ack handle data %s",
        Arrays.toString(ackHandle.getHandleData()));
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:AndroidInvalidationClientStub.java


示例17: acknowledge

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override  // InvalidationClient
public void acknowledge(final AckHandle acknowledgeHandle) {
  Preconditions.checkNotNull(acknowledgeHandle);
  Preconditions.checkState(internalScheduler.isRunningOnThread(),
      "Not running on internal thread");

  // 1. Parse the ack handle first.
  AckHandleP ackHandle;
  try {
    ackHandle = AckHandleP.parseFrom(acknowledgeHandle.getHandleData());
  } catch (InvalidProtocolBufferException exception) {
    logger.warning("Bad ack handle : %s",
      CommonProtoStrings2.toLazyCompactString(acknowledgeHandle.getHandleData()));
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // 2. Validate ack handle - it should have a valid invalidation.
  if (!ackHandle.hasInvalidation() ||
      !msgValidator.isValid(ackHandle.getInvalidation())) {
    logger.warning("Incorrect ack handle data: %s", acknowledgeHandle);
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // Currently, only invalidations have non-trivial ack handle.
  InvalidationP invalidation = ackHandle.getInvalidation();
  if (invalidation.hasPayload()) {
    // Don't send the payload back.
    invalidation = invalidation.toBuilder().clearPayload().build();
  }
  statistics.recordIncomingOperation(IncomingOperationType.ACKNOWLEDGE);
  protocolHandler.sendInvalidationAck(invalidation, batchingTask);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:35,代码来源:InvalidationClientCore.java


示例18: handleInvalidations

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
/** Handles incoming {@code invalidations}. */
private void handleInvalidations(Collection<InvalidationP> invalidations) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");

  for (InvalidationP invalidation : invalidations) {
    AckHandle ackHandle = AckHandle.newInstance(
        CommonProtos2.newAckHandleP(invalidation).toByteArray());
    if (CommonProtos2.isAllObjectId(invalidation.getObjectId())) {
      logger.info("Issuing invalidate all");
      listener.invalidateAll(InvalidationClientCore.this, ackHandle);
    } else {
      // Regular object. Could be unknown version or not.
      Invalidation inv = ProtoConverter.convertFromInvalidationProto(invalidation);

      boolean isSuppressed = invalidation.getIsTrickleRestart();
      logger.info("Issuing invalidate (known-version = %s, is-trickle-restart = %s): %s",
          invalidation.getIsKnownVersion(), isSuppressed, inv);

      // Issue invalidate if the invalidation had a known version AND either no suppression has
      // occurred or the client allows suppression.
      if (invalidation.getIsKnownVersion() &&
          (!isSuppressed || InvalidationClientCore.this.config.getAllowSuppression())) {
        listener.invalidate(InvalidationClientCore.this, inv, ackHandle);
      } else {
        // Otherwise issue invalidateUnknownVersion.
        listener.invalidateUnknownVersion(InvalidationClientCore.this, inv.getObjectId(),
            ackHandle);
      }
    }
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:32,代码来源:InvalidationClientCore.java


示例19: acknowledge

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
protected void acknowledge(Request request, Response.Builder response) {
  String clientKey = request.getClientKey();
  AckHandle ackHandle = request.getAckHandle();
  AndroidInvalidationClient client = clientManager.get(clientKey);
  if (setResponseStatus(client, request, response)) {
    client.acknowledge(ackHandle);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationService.java


示例20: invalidate

import com.google.ipc.invalidation.external.client.types.AckHandle; //导入依赖的package包/类
@Override
public void invalidate(
    InvalidationClient client, Invalidation invalidation, AckHandle ackHandle) {
  Event event = Event.newBuilder(Event.Action.INVALIDATE)
      .setClientKey(clientKey).setInvalidation(invalidation).setAckHandle(ackHandle).build();
  sendEvent(event);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:AndroidClientProxy.java



注:本文中的com.google.ipc.invalidation.external.client.types.AckHandle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultFileTypeSpecificInputFilter类代码示例发布时间:2022-05-23
下一篇:
Java Rectangle类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap