Java Code Examples for com.google.ipc.invalidation.external.client.SystemResources#getNetwork()

The following examples show how to use com.google.ipc.invalidation.external.client.SystemResources#getNetwork() . 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: ProtocolHandler.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param config configuration for the client
 * @param resources resources to use
 * @param smearer a smearer to randomize delays
 * @param statistics track information about messages sent/received, etc
 * @param applicationName name of the application using the library (for debugging/monitoring)
 * @param listener callback for protocol events
 */
ProtocolHandler(ProtocolHandlerConfigP config, final SystemResources resources,
    Smearer smearer, Statistics statistics, int clientType, String applicationName,
    ProtocolListener listener, ProtocolHandlerState marshalledState) {
  this.logger = resources.getLogger();
  this.statistics = statistics;
  this.internalScheduler = resources.getInternalScheduler();
  this.network = resources.getNetwork();
  this.listener = listener;
  this.clientVersion = CommonProtos.newClientVersion(resources.getPlatform(), "Java",
      applicationName);
  this.clientType = clientType;
  if (marshalledState == null) {
    // If there is no marshalled state, construct a clean batcher.
    this.batcher = new Batcher(resources, statistics);
  } else {
    // Otherwise, restore the batcher from the marshalled state.
    this.batcher = new Batcher(resources, statistics, marshalledState.getBatcherState());
    this.messageId = marshalledState.getMessageId();
    this.lastKnownServerTimeMs = marshalledState.getLastKnownServerTimeMs();
    this.nextMessageSendTimeMs = marshalledState.getNextMessageSendTimeMs();
  }
  logger.info("Created protocol handler for application %s, platform %s", applicationName,
      resources.getPlatform());
}
 
Example 2
Source File: ProtocolHandler.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param config configuration for the client
 * @param resources resources to use
 * @param smearer a smearer to randomize delays
 * @param statistics track information about messages sent/received, etc
 * @param applicationName name of the application using the library (for debugging/monitoring)
 * @param listener callback for protocol events
 */
ProtocolHandler(ProtocolHandlerConfigP config, final SystemResources resources,
    Smearer smearer, Statistics statistics, int clientType, String applicationName,
    ProtocolListener listener, TiclMessageValidator2 msgValidator,
    ProtocolHandlerState marshalledState) {
  this.logger = resources.getLogger();
  this.statistics = statistics;
  this.internalScheduler = resources.getInternalScheduler();
  this.network = resources.getNetwork();
  this.listener = listener;
  this.msgValidator = msgValidator;
  this.clientVersion = CommonProtos2.newClientVersion(resources.getPlatform(), "Java",
      applicationName);
  this.clientType = clientType;
  if (marshalledState == null) {
    // If there is no marshalled state, construct a clean batcher.
    this.batcher = new Batcher(resources, statistics);
  } else {
    // Otherwise, restore the batcher from the marshalled state.
    this.batcher = new Batcher(resources, statistics, marshalledState.getBatcherState());
    this.messageId = marshalledState.getMessageId();
    this.lastKnownServerTimeMs = marshalledState.getLastKnownServerTimeMs();
    this.nextMessageSendTimeMs = marshalledState.getNextMessageSendTimeMs();
  }
  logger.info("Created protocol handler for application %s, platform %s", applicationName,
      resources.getPlatform());
}
 
Example 3
Source File: ProtocolHandler.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param config configuration for the client
 * @param resources resources to use
 * @param smearer a smearer to randomize delays
 * @param statistics track information about messages sent/received, etc
 * @param applicationName name of the application using the library (for debugging/monitoring)
 * @param listener callback for protocol events
 */
ProtocolHandler(ProtocolHandlerConfigP config, final SystemResources resources,
    Smearer smearer, Statistics statistics, int clientType, String applicationName,
    ProtocolListener listener, TiclMessageValidator2 msgValidator,
    ProtocolHandlerState marshalledState) {
  this.logger = resources.getLogger();
  this.statistics = statistics;
  this.internalScheduler = resources.getInternalScheduler();
  this.network = resources.getNetwork();
  this.listener = listener;
  this.msgValidator = msgValidator;
  this.clientVersion = CommonProtos2.newClientVersion(resources.getPlatform(), "Java",
      applicationName);
  this.clientType = clientType;
  if (marshalledState == null) {
    // If there is no marshalled state, construct a clean batcher.
    this.batcher = new Batcher(resources, statistics);
  } else {
    // Otherwise, restore the batcher from the marshalled state.
    this.batcher = new Batcher(resources, statistics, marshalledState.getBatcherState());
    this.messageId = marshalledState.getMessageId();
    this.lastKnownServerTimeMs = marshalledState.getLastKnownServerTimeMs();
    this.nextMessageSendTimeMs = marshalledState.getNextMessageSendTimeMs();
  }
  logger.info("Created protocol handler for application %s, platform %s", applicationName,
      resources.getPlatform());
}