コード例 #1
0
  @Test
  public void testPutAsync() throws InterruptedException, ExecutionException {
    RMap<Integer, Integer> map = redisson.getMap("simple");
    Future<Integer> future = map.putAsync(2, 3);
    Assert.assertNull(future.get());

    Assert.assertEquals((Integer) 3, map.get(2));

    Future<Integer> future1 = map.putAsync(2, 4);
    Assert.assertEquals((Integer) 3, future1.get());

    Assert.assertEquals((Integer) 4, map.get(2));
  }
コード例 #2
0
 @Override
 public final void operationComplete(Future<V> future) throws Exception {
   if (future.isSuccess()) {
     onSuccess(future.get());
   } else {
     onFailure(future.cause());
   }
 }