@Test public void testRead() throws InterruptedException, ExecutionException { final ListenableFuture<Optional<NormalizedNode<?, ?>>> readResult = readTx.read(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH); assertTrue(readTx.exists(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH).get()); assertEquals(readResult.get().get(), TestUtils.TEST_CONTAINER); }
@Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { checkRunning(); LOG.debug("{}: Invoking read at {}:{}", txIdentifier, store, path); final ListenerRegistration<DOMDataTreeListener> reg; final SettableFuture<Optional<NormalizedNode<?, ?>>> initialDataTreeChangeFuture = SettableFuture.create(); try { reg = service.registerListener(new ReadShardedListener(initialDataTreeChangeFuture), Collections.singleton(new DOMDataTreeIdentifier(store, path)), false, Collections.emptyList()); registrations.add(reg); } catch (final DOMDataTreeLoopException e) { throw new IllegalStateException("Loop in listener and producers detected", e); } initialDataTreeChangeFuture.addListener(reg::close, MoreExecutors.directExecutor()); return FluentFuture.from(initialDataTreeChangeFuture); }
ShardedDOMReadTransactionAdapter implements DOMDataTreeReadTransaction { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { checkRunning(); LOG.debug("{}: Invoking read at {}:{}", txIdentifier, store, path); final ListenerRegistration<DOMDataTreeListener> reg; final SettableFuture<Optional<NormalizedNode<?, ?>>> initialDataTreeChangeFuture = SettableFuture.create(); try { reg = service.registerListener(new ReadShardedListener(initialDataTreeChangeFuture), Collections.singleton(new DOMDataTreeIdentifier(store, path)), false, Collections.emptyList()); registrations.add(reg); } catch (final DOMDataTreeLoopException e) { throw new IllegalStateException("Loop in listener and producers detected", e); } initialDataTreeChangeFuture.addListener(reg::close, MoreExecutors.directExecutor()); return FluentFuture.from(initialDataTreeChangeFuture); } }
ShardedDOMReadTransactionAdapter implements DOMDataTreeReadTransaction { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { checkRunning(); LOG.debug("{}: Invoking read at {}:{}", txIdentifier, store, path); final ListenerRegistration<DOMDataTreeListener> reg; final SettableFuture<Optional<NormalizedNode<?, ?>>> initialDataTreeChangeFuture = SettableFuture.create(); try { reg = service.registerListener(new ReadShardedListener(initialDataTreeChangeFuture), Collections.singleton(new DOMDataTreeIdentifier(store, path)), false, Collections.emptyList()); registrations.add(reg); } catch (final DOMDataTreeLoopException e) { throw new IllegalStateException("Loop in listener and producers detected", e); } initialDataTreeChangeFuture.addListener(reg::close, MoreExecutors.directExecutor()); return FluentFuture.from(initialDataTreeChangeFuture); } ShardedDOMReadTransactionAdapter(final Object identifier, final DOMDataTreeService service); }
ShardedDOMReadTransactionAdapter implements DOMDataTreeReadTransaction { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { checkRunning(); LOG.debug("{}: Invoking read at {}:{}", txIdentifier, store, path); final ListenerRegistration<DOMDataTreeListener> reg; final SettableFuture<Optional<NormalizedNode<?, ?>>> initialDataTreeChangeFuture = SettableFuture.create(); try { reg = service.registerListener(new ReadShardedListener(initialDataTreeChangeFuture), Collections.singleton(new DOMDataTreeIdentifier(store, path)), false, Collections.emptyList()); registrations.add(reg); } catch (final DOMDataTreeLoopException e) { throw new IllegalStateException("Loop in listener and producers detected", e); } initialDataTreeChangeFuture.addListener(reg::close, MoreExecutors.directExecutor()); return FluentFuture.from(initialDataTreeChangeFuture); } ShardedDOMReadTransactionAdapter(final Object identifier, final DOMDataTreeService service); @Override void close(); @Override Object getIdentifier(); @Override FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
            final YangInstanceIdentifier path); @Override FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path); }
ShardedDOMReadTransactionAdapter implements DOMDataTreeReadTransaction { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { checkRunning(); LOG.debug("{}: Invoking read at {}:{}", txIdentifier, store, path); final ListenerRegistration<DOMDataTreeListener> reg; final SettableFuture<Optional<NormalizedNode<?, ?>>> initialDataTreeChangeFuture = SettableFuture.create(); try { reg = service.registerListener(new ReadShardedListener(initialDataTreeChangeFuture), Collections.singleton(new DOMDataTreeIdentifier(store, path)), false, Collections.emptyList()); registrations.add(reg); } catch (final DOMDataTreeLoopException e) { throw new IllegalStateException("Loop in listener and producers detected", e); } initialDataTreeChangeFuture.addListener(reg::close, MoreExecutors.directExecutor()); return FluentFuture.from(initialDataTreeChangeFuture); } ShardedDOMReadTransactionAdapter(final Object identifier, final DOMDataTreeService service); @Override void close(); @Override Object getIdentifier(); @Override FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
            final YangInstanceIdentifier path); @Override FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path);  }