public RedisDataType metaPutIfAbsent(ByteArrayWrapper key, RedisDataType value) { return this.redisMetaRegion.putIfAbsent(key.toString(), value); }
public Object call() throws Exception { final Region r = getCache().getRegion(REP_REG_NAME); final Region pr = getCache().getRegion(PR_REG_NAME); assertNull(r.putIfAbsent("key0", "value")); assertNull(pr.putIfAbsent("key0", "value")); assertNull(r.putIfAbsent("keyForClient", "value")); assertNull(pr.putIfAbsent("keyForClient", "value")); assertEquals("value", r.putIfAbsent("key0", "value2")); assertEquals("value", pr.putIfAbsent("key0", "value2")); return null; } });
public Object putIfAbsent(Object key, Object value) { try { preOp(); return this.realRegion.putIfAbsent(key, value); } finally { postOp(); } }
public Object putIfAbsent(Object key, Object value) { try { preOp(); return this.realRegion.putIfAbsent(key, value); } finally { postOp(); } }
public Object call() throws Exception { Region r = getCache().getRegion(regionName); r.putIfAbsent(key, null); assertTrue(r.containsKey(key)); return null; }}); client.invoke(new SerializableCallable() {
public Object call() throws Exception { final Region r = getCache().getRegion(regionName); assertEquals("value", r.putIfAbsent("key0", "newValue")); assertTrue(r.containsKeyOnServer("key0")); assertTrue(r.containsKey("key0")); assertTrue(r.containsValueForKey("key0")); return null; } });
public Object call() throws Exception { final Region r = getCache().getRegion(regionName); assertNull(r.putIfAbsent("key0", "value")); assertTrue(r.containsKey("key0")); assertNull(r.putIfAbsent("key2", "value2")); assertTrue(r.containsKey("key2")); return null; } });
@Override public ByteBuffer processStorageCommand(String key, byte[] value, int flags, Cache cache) { Region<Object, ValueWrapper> r = getMemcachedRegion(cache); Object oldVal = r.putIfAbsent(key, ValueWrapper.getWrappedValue(value, flags)); String reply = null; if (oldVal == null) { reply = Reply.STORED.toString(); } else { reply = Reply.NOT_STORED.toString(); } return asciiCharset.encode(reply); }
public Object call() throws Exception { final Region r = getCache().getRegion(regionName); assertNull(r.putIfAbsent("key0", "value")); assertTrue(r.containsKey("key0")); return null; } });
@Override public ByteBuffer processStorageCommand(String key, byte[] value, int flags, Cache cache) { Region<Object, ValueWrapper> r = getMemcachedRegion(cache); Object oldVal = r.putIfAbsent(key, ValueWrapper.getWrappedValue(value, flags)); String reply = null; if (oldVal == null) { reply = Reply.STORED.toString(); } else { reply = Reply.NOT_STORED.toString(); } return asciiCharset.encode(reply); }
public Object call() throws Exception { Region r = getCache().getRegion(regionName); final String key = "bug42221"; r.putIfAbsent(key, null); assertTrue(r.containsKey(key)); Object result = r.replace(key, "not null"); assertEquals(null, result); assertTrue(r.containsKey(key)); assertEquals(r.get(key), "not null"); r.remove(key); // cleanup return null; } });
public Object call() throws Exception { final Region r = getCache().getRegion(REP_REG_NAME); final Region pr = getCache().getRegion(PR_REG_NAME); r.create("createKey", null); pr.create("createKey", null); assertNull(r.putIfAbsent("putAbsentKey", null)); assertNull(pr.putIfAbsent("putAbsentKey", null)); return null; } });
public Object call() throws Exception { Region r = getCache().getRegion(regionName); final String key = "bug42242"; r.putIfAbsent(key, null); assertTrue(r.containsKey(key)); assertTrue(r.containsKeyOnServer(key)); boolean result = r.remove(key, null); assertTrue(result); assertFalse(r.containsKey(key)); assertFalse(r.containsKeyOnServer(key)); return null; } });
public Object call() throws Exception { final Region r = getCache().getRegion(regionName); assertNull(r.putIfAbsent("key0", "value")); assertTrue(r.containsKeyOnServer("key0")); Object v = r.get("key0"); assertNull("expected null but was "+v, v); return null; } });
public Object call() throws Exception { final Region r = getCache().getRegion(regionName); r.create("key0", null); assertNull(r.putIfAbsent("key0", "value")); assertTrue(r.containsKey("key0")); Object v = r.get("key0"); assertNull("expected null but was "+v, v); return null; } });
public void test170PutIfAbsent() { Region<Integer, String> r = createRegion(getName()); r.put(1, "value1"); clearBackingCHM(r); assertEquals("value1", r.putIfAbsent(1, "value2")); }
private void putIfAbsent(Object callback) { Object value; String key; key = getKeyWithProbability_25(); logInfo(opPrefix + " putting object IfAbsent in region named : " + region.getName() + " key=" + key + " callback " + callback); value = getObjectToAdd(key); region.putIfAbsent(key, value); RegionUtil.checkRegionKeyExists(region, key); operationRecorder.entryPutIfAbsent(region.getName(), key, value); }
private boolean setNX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command, ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) { checkAndSetDataType(key, context); Object oldValue = r.putIfAbsent(key, valueWrapper); if (oldValue != null) { command.setResponse(Coder.getNilResponse(context.getByteBufAllocator())); return false; } else { command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS)); return true; } }
protected void putIfAbsent(Region aRegion, boolean logAddition) { Object key = getNewKeyForRegion(aRegion); BaseValueHolder anObj = getValueForKey(key); if (logAddition) { Log.getLogWriter().info("putIfAbsent: calling putIfAbsent for key " + key + ", object " + TestHelper.toString(anObj) + ", region is " + aRegion.getFullPath()); } aRegion.putIfAbsent(key, anObj); Log.getLogWriter().info("putIfAbsent: done creating key " + key); }
private void createEntry(int i) { String key = (String)ObjectHelper.createName(i); Object val = null; String objectType = TestConfig.tab().stringAt(DiskRecoveryPrms.objectType, "objects.ArrayOfByte"); Log.getLogWriter().info("creating entries of type " + objectType); val = ObjectHelper.createObject( objectType, i ); if (TestConfig.tab().getRandGen().nextBoolean()) { Log.getLogWriter().info( "CREATING (putIfAbsent) key = " + key ); aRegion.putIfAbsent(key, val); } else { Log.getLogWriter().info( "CREATING (put) key = " + key ); aRegion.put(key, val); } }