@Override public <T extends DataObject> FluentFuture<Optional<T>> read(final LogicalDatastoreType store, final InstanceIdentifier<T> path) { return delegate.read(store, path); }
@Override public <T extends DataObject> FluentFuture<Optional<T>> read(final InstanceIdentifier<T> path) { return delegate().read(getDatastoreType(), path); }
private void notifyExistingNodes(final EventSourceTopology eventSourceTopology) { LOG.debug("Notify existing nodes"); final Pattern nodeRegex = this.nodeIdPattern; final ReadTransaction tx = eventSourceTopology.getDataBroker().newReadOnlyTransaction(); final ListenableFuture<Optional<Topology>> future = tx.read(LogicalDatastoreType.OPERATIONAL, EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH); Futures.addCallback(future, new FutureCallback<Optional<Topology>>() { @Override public void onSuccess(@Nonnull final Optional<Topology> data) { if (data.isPresent()) { final List<Node> nodes = data.get().getNode(); if (nodes != null) { for (final Node node : nodes) { if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) { notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.key())); } } } } tx.close(); } @Override public void onFailure(final Throwable ex) { LOG.error("Can not notify existing nodes", ex); tx.close(); } }, MoreExecutors.directExecutor()); }
private void readInitialAppConfig(final DataBroker dataBroker) { final FluentFuture<Optional<DataObject>> future; try (ReadTransaction readOnlyTx = dataBroker.newReadOnlyTransaction()) { future = readOnlyTx.read(LogicalDatastoreType.CONFIGURATION, bindingContext.appConfigPath); } future.addCallback(new FutureCallback<Optional<DataObject>>() { @Override public void onSuccess(final Optional<DataObject> possibleAppConfig) { LOG.debug("{}: Read of app config {} succeeded: {}", logName(), bindingContext .appConfigBindingClass.getName(), possibleAppConfig); setInitialAppConfig(possibleAppConfig); } @Override public void onFailure(final Throwable failure) { // We may have gotten the app config via the data tree change listener so only retry if not. if (readingInitialAppConfig.get()) { LOG.warn("{}: Read of app config {} failed - retrying", logName(), bindingContext.appConfigBindingClass.getName(), failure); readInitialAppConfig(dataBroker); } } }, MoreExecutors.directExecutor()); }
FluentFuture<Optional<OuterList>> submitFuture = tx.read(dsType, iid);
.child(OuterList.class, new OuterListKey((int)l)); Optional<OuterList> optionalDataObject; FluentFuture<Optional<OuterList>> submitFuture = tx.read(dsType, iid); try { optionalDataObject = submitFuture.get();