Exemple #1
0
  public void doIt() throws InterruptedException, ExecutionException {
    FetchBucketPropsOperation bpOp =
        new FetchBucketPropsOperation.Builder(BinaryValue.unsafeCreate("test_bucket3)".getBytes()))
            .withBucketType(BinaryValue.unsafeCreate("test_type2".getBytes()))
            .build();

    cluster.execute(bpOp);
    BucketProperties props = bpOp.get();
    System.out.println(props);

    FetchOperation fetchOp =
        new FetchOperation.Builder(
                BinaryValue.unsafeCreate("test_bucket2".getBytes()),
                BinaryValue.unsafeCreate("test_key2".getBytes()))
            .build();

    // fetchOp.addListener(this);
    cluster.execute(fetchOp);
    FetchOperation.Response resp = fetchOp.get();
    System.out.println(resp.isNotFound());
    for (RiakObject ro : resp.getObjectList()) {
      System.out.println("value: " + ro.getValue());
      System.out.println(ro.isDeleted());
    }
    cluster.shutdown();
  }
Exemple #2
0
  @Override
  public void handle(RiakFuture<RiakObject> f) {
    try {
      RiakObject ro = f.get();
      System.out.println("value: " + ro.getValue());
      System.out.println(ro.isDeleted());

      cluster.shutdown();
    } catch (InterruptedException ex) {
      Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ExecutionException ex) {
      Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
    }
  }