Code example for ListenableFuture

Methods: get

0
        return tx;
    } 
 
    private static void assertCommitSuccessful(final ListenableFuture<Void> future)
            throws InterruptedException, ExecutionException {
        future.get();
    } 
 
    private static void assertTestContainerExists(final DOMDataReadTransaction readTx) throws InterruptedException,
            ExecutionException {
        ListenableFuture<Optional<NormalizedNode<?, ?>>> readFuture = readTx.read(OPERATIONAL, TestModel.TEST_PATH);
        Optional<NormalizedNode<?, ?>> readedData = readFuture.get();
        assertTrue(readedData.isPresent());
    } 
 
    private static void assertTestContainerWrite(final DOMDataReadWriteTransaction tx) throws InterruptedException,
            ExecutionException {
        tx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
        assertTestContainerExists(tx);
    }