本文整理汇总了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();
}
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}