Java Code Examples for com.google.ipc.invalidation.external.client.InvalidationListener#invalidateAll()

The following examples show how to use com.google.ipc.invalidation.external.client.InvalidationListener#invalidateAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidInvalidationListenerIntentMapper.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
  }
}
 
Example 2
Source File: AndroidInvalidationListenerIntentMapper.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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);
  }
}
 
Example 3
Source File: AndroidInvalidationListenerIntentMapper.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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);
  }
}
 
Example 4
Source File: InvalidationTestListener.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void invalidateAll(InvalidationClient client, AckHandle ackHandle) {
  InvalidationListener listener = getListener(client);
  logger.fine("Received INVALIDATE_ALL for %s: %s", getClientKey(client), listener);
  if (listener != null) {
    listener.invalidateAll(client, ackHandle);
  }
}
 
Example 5
Source File: InvalidationTestListener.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void invalidateAll(InvalidationClient client, AckHandle ackHandle) {
  InvalidationListener listener = getListener(client);
  logger.fine("Received INVALIDATE_ALL for %s: %s", getClientKey(client), listener);
  if (listener != null) {
    listener.invalidateAll(client, ackHandle);
  }
}