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


Java TypedUtil.mapGet方法代码示例

本文整理汇总了Java中com.google.ipc.invalidation.util.TypedUtil.mapGet方法的典型用法代码示例。如果您正苦于以下问题:Java TypedUtil.mapGet方法的具体用法?Java TypedUtil.mapGet怎么用?Java TypedUtil.mapGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.ipc.invalidation.util.TypedUtil的用法示例。


在下文中一共展示了TypedUtil.mapGet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleImplicitSchedulerEvent

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Runs all tasks that are ready to run. */
void handleImplicitSchedulerEvent() {
  try {
    while (!scheduledTasks.isEmpty() && (scheduledTasks.firstKey() <= clock.nowMs())) {
      Map.Entry<Long, String> scheduledTask = scheduledTasks.pollFirstEntry();
      Runnable runnable = TypedUtil.mapGet(registeredTasks, scheduledTask.getValue());
      if (runnable == null) {
        logger.severe("No task registered for %s", scheduledTask.getValue());
        continue;
      }
      runnable.run();
    }
  } finally {
    if (!scheduledTasks.isEmpty()) {
      ensureIntentScheduledForSoonestTask();
    }
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:AndroidInternalScheduler.java

示例2: decodeTiclState

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/**
 * Returns the persisted state for the client with key {@code clientKey} in
 * {@code storageForClient}, or {@code null} if no valid state could be found.
 * <p>
 * REQUIRES: {@code storageForClient}.load() has been called successfully.
 */


PersistentTiclState decodeTiclState(final String clientKey, AndroidStorage storageForClient) {
  synchronized (lock) {
    // Retrieve the serialized state.
    final Map<String, byte[]> properties = storageForClient.getPropertiesUnsafe();
    byte[] clientStateBytes = TypedUtil.mapGet(properties,
        InvalidationClientCore.CLIENT_TOKEN_KEY);
    if (clientStateBytes == null) {
      logger.warning("No client state found in storage for %s: %s", clientKey,
          properties.keySet());
      return null;
    }

    // Deserialize it.
    PersistentTiclState clientState =
        PersistenceUtils.deserializeState(logger, clientStateBytes, digestFn);
    if (clientState == null) {
      logger.warning("Invalid client state found in storage for %s", clientKey);
      return null;
    }
    return clientState;
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:31,代码来源:AndroidInvalidationService.java

示例3: create

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
@Override
protected void create(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(request, Action.CREATE, Parameter.ACTION, Parameter.CLIENT,
        Parameter.CLIENT_TYPE, Parameter.ACCOUNT, Parameter.AUTH_TYPE, Parameter.INTENT);
    logger.info("Creating client %s:%s", request.getClientKey(), clientMap.keySet());
    if (!TypedUtil.containsKey(clientMap, request.getClientKey())) {
      // If no client exists with this key, create one.
      clientMap.put(
          request.getClientKey(), new ClientState(request.getAccount(), request.getAuthType(),
              request.getIntent()));
    } else {
      // Otherwise, verify that the existing client has the same account / auth type / intent.
      ClientState existingState = TypedUtil.mapGet(clientMap, request.getClientKey());
      Preconditions.checkState(request.getAccount().equals(existingState.account));
      Preconditions.checkState(request.getAuthType().equals(existingState.authType));
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:InvalidationTestService.java

示例4: incrementPerformanceCounterValue

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/**
 * Looks for an enum value with the given {@code fieldName} in {@code valueOfMap} and increments
 * the corresponding entry in {@code counts} by {@code counterValue}. Call to update statistics
 * for a single performance counter.
 */
private static <Key extends Enum<Key>> void incrementPerformanceCounterValue(Logger logger,
    Map<String, Key> valueOfMap, Map<Key, Integer> counts, String fieldName, int counterValue) {
  Key type = TypedUtil.mapGet(valueOfMap, fieldName);
  if (type != null) {
    int currentValue = TypedUtil.mapGet(counts, type);
    counts.put(type, currentValue + counterValue);
  } else {
    logger.warning("Skipping unknown enum value name %s", fieldName);
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:Statistics.java

示例5: handleSchedulerEvent

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/**
 * Handles an event intent created in {@link #schedule} by running that event, along with any
 * other events whose time has come.
 */
void handleSchedulerEvent(AndroidSchedulerEvent event) {
  Runnable recurringTaskRunnable = TypedUtil.mapGet(registeredTasks, event.getEventName());
  if (recurringTaskRunnable == null) {
    throw new NullPointerException("No task registered for " + event.getEventName());
  }
  if (ticlId != event.getTiclId()) {
    logger.warning("Ignoring event with wrong ticl id (not %s): %s", ticlId, event);
    return;
  }
  recurringTaskRunnable.run();
  handleImplicitSchedulerEvent();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:AndroidInternalScheduler.java

示例6: getHighestAckedVersion

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/**
 * Returns the highest acked version for the object id with the given key, or
 * -1 if no versions have been acked.
 */
private long getHighestAckedVersion(ObjectIdP objectId) {
  Long version = TypedUtil.mapGet(highestAckedVersionMap, objectId);
  return (version != null) ? version : -1L;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:AckCache.java

示例7: getClientErrorCounterForTest

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Returns the counter value for {@code clientErrorType}. */
int getClientErrorCounterForTest(ClientErrorType clientErrorType) {
  return TypedUtil.mapGet(clientErrorTypes, clientErrorType);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:Statistics.java

示例8: getSentMessageCounterForTest

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Returns the counter value for {@code sentMessageType}. */
int getSentMessageCounterForTest(SentMessageType sentMessageType) {
  return TypedUtil.mapGet(sentMessageTypes, sentMessageType);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:Statistics.java

示例9: getReceivedMessageCounterForTest

import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Returns the counter value for {@code receivedMessageType}. */
int getReceivedMessageCounterForTest(ReceivedMessageType receivedMessageType) {
  return TypedUtil.mapGet(receivedMessageTypes, receivedMessageType);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:5,代码来源:Statistics.java


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