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

Java Invalidation类代码示例

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

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



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

示例1: tryHandleBackgroundInvalidationsIntent

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Tries to handle a background invalidation intent. Returns {@code true} iff the intent is a
 * background invalidation intent.
 */
private boolean tryHandleBackgroundInvalidationsIntent(Intent intent) {
  byte[] data = intent.getByteArrayExtra(ProtocolIntents.BACKGROUND_INVALIDATION_KEY);
  if (data == null) {
    return false;
  }
  try {
    InvalidationMessage invalidationMessage = InvalidationMessage.parseFrom(data);
    List<Invalidation> invalidations = new ArrayList<Invalidation>();
    for (InvalidationP invalidation : invalidationMessage.getInvalidation()) {
      invalidations.add(ProtoWrapperConverter.convertFromInvalidationProto(invalidation));
    }
    backgroundInvalidateForInternalUse(invalidations);
  } catch (ValidationException exception) {
    logger.info("Failed to parse background invalidation intent payload: %s",
        exception.getMessage());
  }
  return false;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:AndroidListener.java


示例2: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
@Override
public void invalidate(Invalidation invalidation, byte[] ackHandle) {
    byte[] payload = invalidation.getPayload();
    String payloadStr = (payload == null) ? null : new String(payload);
    requestSync(invalidation.getObjectId(), invalidation.getVersion(), payloadStr);
    acknowledge(ackHandle);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:8,代码来源:InvalidationClientService.java


示例3: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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: handleInvalidations

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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


示例5: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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


示例6: convertFromInvalidationProto

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Converts an invalidation protocol buffer {@code invalidation} to the
 * corresponding external object and returns it
 */
public static Invalidation convertFromInvalidationProto(InvalidationP invalidation) {
  Preconditions.checkNotNull(invalidation);
  ObjectId objectId = convertFromObjectIdProto(invalidation.getObjectId());

  // No bridge arrival time in invalidation.
  return Invalidation.newInstance(objectId, invalidation.getVersion(),
      invalidation.hasPayload() ? invalidation.getPayload().getByteArray() : null,
          invalidation.getIsTrickleRestart());
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:14,代码来源:ProtoWrapperConverter.java


示例7: convertToInvalidationProto

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Converts an invalidation {@code invalidation} to the corresponding protocol
 * buffer and returns it.
 */
public static InvalidationP convertToInvalidationProto(Invalidation invalidation) {
  Preconditions.checkNotNull(invalidation);
  ObjectIdP objectId = convertToObjectIdProto(invalidation.getObjectId());

  // Invalidations clients do not know about trickle restarts. Every invalidation is allowed
  // to suppress earlier invalidations and acks implicitly acknowledge all previous
  // invalidations. Therefore the correct semanantics are provided by setting isTrickleRestart to
  // true.
  return CommonProtos.newInvalidationP(objectId, invalidation.getVersion(),
      invalidation.getIsTrickleRestartForInternalUse(), invalidation.getPayload());
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:ProtoWrapperConverter.java


示例8: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
@Override
public void invalidate(Invalidation invalidation, byte[] ackHandle) {
  Log.i(TAG, "invalidate: " + invalidation);

  // Do real work here based upon the invalidation
  MainActivity.State.setVersion(
      invalidation.getObjectId(), "invalidate", invalidation.toString());

  acknowledge(ackHandle);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:ExampleListener.java


示例9: convertFromInvalidationProto

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Converts an invalidation protocol buffer {@code invalidation} to the
 * corresponding external object and returns it
 */
public static Invalidation convertFromInvalidationProto(InvalidationP invalidation) {
  Preconditions.checkNotNull(invalidation);
  ObjectId objectId = convertFromObjectIdProto(invalidation.getObjectId());

  // No bridge arrival time in invalidation.
  return Invalidation.newInstance(objectId, invalidation.getVersion(),
      invalidation.hasPayload() ? invalidation.getPayload().toByteArray() : null,
          invalidation.getIsTrickleRestart());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:14,代码来源:ProtoConverter.java


示例10: convertToInvalidationProto

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Converts an invalidation {@code invalidation} to the corresponding protocol
 * buffer and returns it.
 */
public static InvalidationP convertToInvalidationProto(Invalidation invalidation) {
  Preconditions.checkNotNull(invalidation);
  ObjectIdP objectId = convertToObjectIdProto(invalidation.getObjectId());

  // Invalidations clients do not know about trickle restarts. Every invalidation is allowed
  // to suppress earlier invalidations and acks implicitly acknowledge all previous
  // invalidations. Therefore the correct semanantics are provided by setting isTrickleRestart to
  // true.
  return CommonProtos2.newInvalidationP(objectId, invalidation.getVersion(),
      TrickleState.fromBoolean(invalidation.getIsTrickleRestartForInternalUse()),
      invalidation.getPayload() == null ? null : ByteString.copyFrom(invalidation.getPayload()));
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:ProtoConverter.java


示例11: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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


示例12: handleInvalidations

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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


示例13: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的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


示例14: ParcelableInvalidation

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Creates a new invalidation wrapper by reading data from a parcel.
 */
public ParcelableInvalidation(Parcel in) {
  // Read parcelable object id from parcel using the application class loader
  ParcelableObjectId objectId = in.readParcelable(getClass().getClassLoader());
  long version = in.readLong();
  boolean isTrickleRestart = in.createBooleanArray()[0];
  boolean[] values = in.createBooleanArray();
  byte[] payload = null;
  if (values[0]) { // hasPayload
    payload = in.createByteArray();
  }
  this.invalidation = Invalidation.newInstance(objectId.objectId, version, payload,
      isTrickleRestart);
  this.includePayload = payload != null;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:ParcelableInvalidation.java


示例15: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
@Override
public void invalidate(
    InvalidationClient client, Invalidation invalidation, AckHandle ackHandle) {
  InvalidationListener listener = getListener(client);
  logger.fine("Received INVALIDATE for %s: %s", getClientKey(client), listener);
  if (listener != null) {
    listener.invalidate(client, invalidation, ackHandle);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:InvalidationTestListener.java


示例16: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
@Override
public void invalidate(InvalidationClient client, Invalidation invalidation,
    AckHandle ackHandle) {
  AndroidListener.this.invalidate(invalidation, ackHandle.getHandleData());
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:6,代码来源:AndroidListener.java


示例17: setInvalidation

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Stores in invalidation within an event message.
 */
public Builder setInvalidation(Invalidation invalidation) {
  bundle.putParcelable(Parameter.INVALIDATION, new ParcelableInvalidation(invalidation, true));
  return this;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:Event.java


示例18: getInvalidation

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Returns an invalidation from an event message, or {@code null} if not present.
 */
public Invalidation getInvalidation() {
  ParcelableInvalidation parcelableInvalidation =
      parameters.getParcelable(Parameter.INVALIDATION);
  return parcelableInvalidation != null ? parcelableInvalidation.invalidation : null;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:Event.java


示例19: invalidate

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Indicates that an object has been updated to a particular version.
 * <ul>
 *   <li> When it receives this call, the application MUST hit its backend to fetch the
 *   updated state of the object, unless it already has has a version at least as recent as that
 *   of the invalidation.
 *
 *   <li>  MAY choose to drop older versions of invalidations, as long as it calls
 *   {@link #invalidate} with a later version of the same object, or calls
 *   {@link #invalidateUnknownVersion}.
 *
 *   <li>  MAY reorder or duplicate invalidations.
 *
 *   <li>  MAY drop a published payload without notice.
 *
 *   <li> The application MUST acknowledge this event by calling
 *   {@link InvalidationClient#acknowledge} with the provided {@code ackHandle}, otherwise the
 *   event will be redelivered.
 * </ul>
 *
 * @param client the {@link InvalidationClient} invoking the listener
 * @param ackHandle event acknowledgement handle
 */
void invalidate(InvalidationClient client, Invalidation invalidation, AckHandle ackHandle);
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:InvalidationListener.java


示例20: backgroundInvalidateForInternalUse

import com.google.ipc.invalidation.external.client.types.Invalidation; //导入依赖的package包/类
/**
 * Handles invalidations received while the client is stopped. An implementation may choose to
 * do work in response to these invalidations (delivered best-effort by the invalidation system).
 * Not intended for use by most client implementations.
 */
protected void backgroundInvalidateForInternalUse(
    @SuppressWarnings("unused") Iterable<Invalidation> invalidations) {
  // Ignore background invalidations by default.
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:AndroidListener.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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