本文整理汇总了Java中com.google.ipc.invalidation.util.TypedUtil.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java TypedUtil.containsKey方法的具体用法?Java TypedUtil.containsKey怎么用?Java TypedUtil.containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.ipc.invalidation.util.TypedUtil
的用法示例。
在下文中一共展示了TypedUtil.containsKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: isLoadedForTest
import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Returns whether the client with key {@code clientKey} is in memory. */
public boolean isLoadedForTest(String clientKey) {
synchronized (lock) {
return TypedUtil.containsKey(clientMap, clientKey);
}
}
示例3: clientExists
import com.google.ipc.invalidation.util.TypedUtil; //导入方法依赖的package包/类
/** Returns whether a client with key {@code clientKey} is known to the service. */
public static boolean clientExists(String clientKey) {
synchronized (LOCK) {
return TypedUtil.containsKey(clientMap, clientKey);
}
}