com.google.ipc.invalidation.ticl.InvalidationClientImpl Java Examples

The following examples show how to use com.google.ipc.invalidation.ticl.InvalidationClientImpl. 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: AndroidClientProxy.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Creates a new InvalidationClient instance that the proxy will delegate requests to and listen
 * for events from.
 */
// Overridden by tests to inject mock clients or for listener interception

InvalidationClient createClient(SystemResources resources, int clientType, byte[] clientName,
    String applicationName, InvalidationListener listener, ClientConfigP config) {
  // We always use C2DM, so set the channel-supports-offline-delivery bit on our config.
  final ClientConfigP.Builder configBuilder;
  if (config == null) {
    configBuilder = InvalidationClientCore.createConfig();
  } else {
    configBuilder = ClientConfigP.newBuilder(config);
  }
  configBuilder.setChannelSupportsOfflineDelivery(true);
  config = configBuilder.build();
  Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
  return new InvalidationClientImpl(resources, random, clientType, clientName, config,
      applicationName, listener);
}
 
Example #2
Source File: AndroidClientProxy.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Creates a new InvalidationClient instance that the proxy will delegate requests to and listen
 * for events from.
 */
// Overridden by tests to inject mock clients or for listener interception

InvalidationClient createClient(SystemResources resources, int clientType, byte[] clientName,
    String applicationName, InvalidationListener listener, ClientConfigP config) {
  // We always use C2DM, so set the channel-supports-offline-delivery bit on our config.
  final ClientConfigP.Builder configBuilder;
  if (config == null) {
    configBuilder = InvalidationClientCore.createConfig();
  } else {
    configBuilder = ClientConfigP.newBuilder(config);
  }
  configBuilder.setChannelSupportsOfflineDelivery(true);
  config = configBuilder.build();
  Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
  return new InvalidationClientImpl(resources, random, clientType, clientName, config,
      applicationName, listener);
}
 
Example #3
Source File: InvalidationClientFactory.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an invalidation client library instance.
 *
 * @param resources {@link SystemResources} to use for logging, scheduling, persistence, and
 *     network connectivity
 * @param clientConfig application provided configuration for the client.
 * @param listener callback object for invalidation events
 */
public static InvalidationClient createClient(SystemResources resources,
    InvalidationClientConfig clientConfig, InvalidationListener listener) {
  ClientConfigP.Builder internalConfigBuilder = InvalidationClientCore.createConfig().toBuilder();
  internalConfigBuilder.allowSuppression = clientConfig.allowSuppression;
  ClientConfigP internalConfig = internalConfigBuilder.build();
  Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
  return new InvalidationClientImpl(resources, random, clientConfig.clientType,
      clientConfig.clientName, internalConfig, clientConfig.applicationName, listener);
}
 
Example #4
Source File: InvalidationClientFactory.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Constructs an invalidation client library instance.
 *
 * @param resources {@link SystemResources} to use for logging, scheduling, persistence, and
 *     network connectivity
 * @param clientConfig application provided configuration for the client.
 * @param listener callback object for invalidation events
 */
public static InvalidationClient createClient(SystemResources resources,
    InvalidationClientConfig clientConfig, InvalidationListener listener) {
  ClientConfigP internalConfig = InvalidationClientCore.createConfig()
      .setAllowSuppression(clientConfig.allowSuppression)
      .build();
  Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
  return new InvalidationClientImpl(resources, random, clientConfig.clientType,
      clientConfig.clientName, internalConfig, clientConfig.applicationName, listener);
}
 
Example #5
Source File: InvalidationClientFactory.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Constructs an invalidation client library instance.
 *
 * @param resources {@link SystemResources} to use for logging, scheduling, persistence, and
 *     network connectivity
 * @param clientConfig application provided configuration for the client.
 * @param listener callback object for invalidation events
 */
public static InvalidationClient createClient(SystemResources resources,
    InvalidationClientConfig clientConfig, InvalidationListener listener) {
  ClientConfigP internalConfig = InvalidationClientCore.createConfig()
      .setAllowSuppression(clientConfig.allowSuppression)
      .build();
  Random random = new Random(resources.getInternalScheduler().getCurrentTimeMs());
  return new InvalidationClientImpl(resources, random, clientConfig.clientType,
      clientConfig.clientName, internalConfig, clientConfig.applicationName, listener);
}