Java Code Examples for com.google.ipc.invalidation.util.TypedUtil#containsKey()
The following examples show how to use
com.google.ipc.invalidation.util.TypedUtil#containsKey() .
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: InvalidationTestService.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
@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); } }
Example 2
Source File: InvalidationTestService.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
@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); } }
Example 3
Source File: AndroidClientManager.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Returns whether the client with key {@code clientKey} is in memory. */ public boolean isLoadedForTest(String clientKey) { synchronized (lock) { return TypedUtil.containsKey(clientMap, clientKey); } }
Example 4
Source File: InvalidationTestService.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** 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); } }
Example 5
Source File: AndroidClientManager.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** Returns whether the client with key {@code clientKey} is in memory. */ public boolean isLoadedForTest(String clientKey) { synchronized (lock) { return TypedUtil.containsKey(clientMap, clientKey); } }
Example 6
Source File: InvalidationTestService.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
/** 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); } }