当前位置: 首页>>代码示例>>Java>>正文


Java SimplePair类代码示例

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


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

示例1: sendInfoMessageToServer

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/**
 * Sends an info message to the server. If {@code mustSendPerformanceCounters} is true,
 * the performance counters are sent regardless of when they were sent earlier.
 */
private void sendInfoMessageToServer(boolean mustSendPerformanceCounters,
    boolean requestServerSummary) {
  logger.info("Sending info message to server; request server summary = %s",
      requestServerSummary);
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");

  List<SimplePair<String, Integer>> performanceCounters =
      new ArrayList<SimplePair<String, Integer>>();
  ClientConfigP configToSend = null;
  if (mustSendPerformanceCounters) {
    statistics.getNonZeroStatistics(performanceCounters);
    configToSend = config;
  }
  protocolHandler.sendInfoMessage(performanceCounters, configToSend, requestServerSummary,
      batchingTask);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:InvalidationClientCore.java

示例2: scheduleStartAfterReadingStateBlob

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/** Reads the Ticl state from persistent storage (if any) and calls {@code startInternal}. */
private void scheduleStartAfterReadingStateBlob() {
  storage.readKey(CLIENT_TOKEN_KEY, new Callback<SimplePair<Status, byte[]>>() {
    @Override
    public void accept(final SimplePair<Status, byte[]> readResult) {
      Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
      final byte[] serializedState = readResult.getFirst().isSuccess() ?
          readResult.getSecond() : null;
      // Call start now.
      if (!readResult.getFirst().isSuccess()) {
        statistics.recordError(ClientErrorType.PERSISTENT_READ_FAILURE);
        logger.warning("Could not read state blob: %s", readResult.getFirst().getMessage());
      }
      startInternal(serializedState);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:InvalidationClientCore.java

示例3: readKey

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readKey(final String key, final Callback<SimplePair<Status, byte[]>> done) {
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.readKey") {
    @Override
    public void run() {
      byte[] value = TypedUtil.mapGet(ticlPersistentState, key);
      final SimplePair<Status, byte[]> result;
      if (value != null) {
        result = SimplePair.of(Status.newInstance(Status.Code.SUCCESS, ""), value);
      } else {
        String error = "No value present in map for " + key;
        result = SimplePair.of(Status.newInstance(Status.Code.PERMANENT_FAILURE, error), null);
      }
      done.accept(result);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:MemoryStorageImpl.java

示例4: sendInfoMessage

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/**
 * Sends an info message to the server with the performance counters supplied
 * in {@code performanceCounters} and the config supplies in
 * {@code configParams}.
 *
 * @param requestServerRegistrationSummary indicates whether to request the
 *        server's registration summary
 */
void sendInfoMessage(List<SimplePair<String, Integer>> performanceCounters,
    ClientConfigP clientConfig, boolean requestServerRegistrationSummary,
    BatchingTask batchingTask) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");

  List<PropertyRecord> performanceCounterRecords =
      new ArrayList<PropertyRecord>(performanceCounters.size());
  for (SimplePair<String, Integer> counter : performanceCounters) {
    performanceCounterRecords.add(PropertyRecord.create(counter.first, counter.second));
  }
  InfoMessage infoMessage = InfoMessage.create(clientVersion, /* configParameter */ null,
      performanceCounterRecords, requestServerRegistrationSummary, clientConfig);

  // Simply store the message in pendingInfoMessage and send it when the batching task runs.
  batcher.setInfoMessage(infoMessage);
  batchingTask.ensureScheduled("Send-info");
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:26,代码来源:ProtocolHandler.java

示例5: sendInfoMessageToServer

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/**
 * Sends an info message to the server. If {@code mustSendPerformanceCounters} is true,
 * the performance counters are sent regardless of when they were sent earlier.
 */
private void sendInfoMessageToServer(boolean mustSendPerformanceCounters,
    boolean requestServerSummary) {
  logger.info("Sending info message to server; request server summary = %s",
      requestServerSummary);
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");

  List<SimplePair<String, Integer>> performanceCounters =
      new ArrayList<SimplePair<String, Integer>>();
  List<SimplePair<String, Integer>> configParams =
      new ArrayList<SimplePair<String, Integer>>();
  ClientConfigP configToSend = null;
  if (mustSendPerformanceCounters) {
    statistics.getNonZeroStatistics(performanceCounters);
    configToSend = config;
  }
  protocolHandler.sendInfoMessage(performanceCounters, configToSend, requestServerSummary,
      batchingTask);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:23,代码来源:InvalidationClientCore.java

示例6: readKey

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readKey(final String key, final Callback<SimplePair<Status, byte[]>> done) {
  scheduler.execute(new NamedRunnable("AndroidStorage.readKey") {
    @Override
    public void run() {
        byte [] value = properties.get(key);
        if (value != null) {
          done.accept(SimplePair.of(SUCCESS, value));
        } else {
          Status status =
              Status.newInstance(Status.Code.PERMANENT_FAILURE, "No value in map for " + key);
          done.accept(SimplePair.of(status, (byte []) null));
        }
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:AndroidStorage.java

示例7: getNonZeroStatistics

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/**
 * Modifies {@code performanceCounters} to contain all the statistics that are non-zero. Each pair
 * has the name of the statistic event and the number of times that event has occurred since the
 * client started.
 */
public void getNonZeroStatistics(List<SimplePair<String, Integer>> performanceCounters) {
  // Add the non-zero values from the different maps to performanceCounters.
  fillWithNonZeroStatistics(sentMessageTypes, performanceCounters, SENT_MESSAGE_TYPE_NAME);
  fillWithNonZeroStatistics(receivedMessageTypes, performanceCounters,
      RECEIVED_MESSAGE_TYPE_NAME);
  fillWithNonZeroStatistics(incomingOperationTypes, performanceCounters,
      INCOMING_OPERATION_TYPE_NAME);
  fillWithNonZeroStatistics(listenerEventTypes, performanceCounters, LISTENER_EVENT_TYPE_NAME);
  fillWithNonZeroStatistics(clientErrorTypes, performanceCounters, CLIENT_ERROR_TYPE_NAME);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:Statistics.java

示例8: fillWithNonZeroStatistics

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
/** Modifies {@code result} to contain those statistics from {@code map} whose value is > 0. */
private static <Key extends Enum<Key>> void fillWithNonZeroStatistics(Map<Key, Integer> map,
    List<SimplePair<String, Integer>> destination, String typeName) {
  String prefix = typeName + ".";
  for (Map.Entry<Key, Integer> entry : map.entrySet()) {
    if (entry.getValue() > 0) {
      destination.add(SimplePair.of(prefix + entry.getKey().name(), entry.getValue()));
    }
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:11,代码来源:Statistics.java

示例9: marshal

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public StatisticsState marshal() {
  // Get all the non-zero counters, convert them to proto PropertyRecord messages, and return
  // a StatisticsState containing the records.
  List<SimplePair<String, Integer>> counters = new ArrayList<SimplePair<String, Integer>>();
  getNonZeroStatistics(counters);
  List<PropertyRecord> propertyRecords = new ArrayList<PropertyRecord>(counters.size());
  for (SimplePair<String, Integer> counter : counters) {
    propertyRecords.add(PropertyRecord.create(counter.getFirst(), counter.getSecond()));
  }
  return StatisticsState.create(propertyRecords);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:13,代码来源:Statistics.java

示例10: readAllKeys

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readAllKeys(Callback<SimplePair<Status, String>> keyCallback) {
  // If the state file exists, supply the CLIENT_TOKEN_KEY as a present key.
  if (context.getFileStreamPath(STATE_FILENAME).exists()) {
    Status status = Status.newInstance(Status.Code.SUCCESS, "");
    keyCallback.accept(SimplePair.of(status, InvalidationClientCore.CLIENT_TOKEN_KEY));
  }
  keyCallback.accept(null);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:AndroidStorage.java

示例11: readKey

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readKey(String key, final Callback<SimplePair<Status, byte[]>> done) {
  delegate.readKey(key, new Callback<SimplePair<Status, byte[]>>() {
    @Override
    public void accept(final SimplePair<Status, byte[]> result) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.readKey") {
        @Override
        public void run() {
          done.accept(result);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java

示例12: readAllKeys

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> keyCallback) {
  delegate.readAllKeys(new Callback<SimplePair<Status, String>>() {
    @Override
    public void accept(final SimplePair<Status, String> keyResult) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.readAllKeys") {
        @Override
        public void run() {
          keyCallback.accept(keyResult);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java

示例13: readAllKeys

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> done) {
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.readAllKeys") {
    @Override
    public void run() {
      Status successStatus = Status.newInstance(Status.Code.SUCCESS, "");
      for (String key : ticlPersistentState.keySet()) {
        done.accept(SimplePair.of(successStatus, key));
      }
      done.accept(null);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:MemoryStorageImpl.java

示例14: marshal

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public StatisticsState marshal() {
  // Get all the non-zero counters, convert them to proto PropertyRecord messages, and return
  // a StatisticsState containing the records.
  StatisticsState.Builder builder = StatisticsState.newBuilder();
  List<SimplePair<String, Integer>> counters = new ArrayList<SimplePair<String, Integer>>();
  getNonZeroStatistics(counters);
  for (SimplePair<String, Integer> counter : counters) {
    builder.addCounter(CommonProtos2.newPropertyRecord(counter.getFirst(), counter.getSecond()));
  }
  return builder.build();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:Statistics.java

示例15: readAllKeys

import com.google.ipc.invalidation.external.client.types.SimplePair; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> keyCallback) {
  scheduler.execute(new NamedRunnable("AndroidStorage.readAllKeys") {
    @Override
    public void run() {
      for (String key : properties.keySet()) {
        keyCallback.accept(SimplePair.of(SUCCESS, key));
      }
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidStorage.java


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