IrdInstance getInstance(ResourceId rid) { ReadTransaction rx = m_dataBroker.newReadOnlyTransaction(); try { return SimpleIrdUtils.readInstance(rid, rx); } catch (Exception e) { return null; } }
@Override public void close() throws Exception { // When we close this service we need to shutdown our executor! executor.shutdown(); if (dataProvider != null) { WriteTransaction tx = dataProvider.newWriteOnlyTransaction(); LOG.info(" Transaction written"); tx.delete(LogicalDatastoreType.CONFIGURATION, alertMessageCountRuleRecordId); } }
public void registerAsDataChangeListener() { dataChangeListenerRegistration = dataBroker.registerDataChangeListener(dataStoreType, instanceIdentifier, this, DataBroker.DataChangeScope.SUBTREE); }
@Override public ListenerRegistration<StatAbstractListenCommit<T, N>> call() throws Exception { return db.registerDataTreeChangeListener(treeId,StatAbstractListenCommit.this); } });
/** * {@inheritDoc} */ @Override public ReadWriteTransaction newReadWriteTransaction() { return dataBroker.newReadWriteTransaction(); }
OperationProcessor(final DataBroker dataBroker) { this.dataBroker = Preconditions.checkNotNull(dataBroker); this.queue = new LinkedBlockingQueue<HostTrackerOperation>(QUEUE_DEPTH); this.transactionChain = dataBroker.createTransactionChain(this); }
@Override public ListenerRegistration<FlowForwarder> call() throws Exception { return db.registerDataTreeChangeListener(treeId, FlowForwarder.this); } });
/** * {@inheritDoc} */ @Override public final ReadWriteTransaction newReadWriteTransaction() { return dataBroker.newReadWriteTransaction(); } }
public OperationProcessor(final DataBroker dataBroker) { this.dataBroker = Preconditions.checkNotNull(dataBroker); transactionChain = this.dataBroker.createTransactionChain(this); thread = new Thread(this); thread.setDaemon(true); thread.setName("FlowCapableTopologyExporter-" + FlowCapableTopologyProvider.TOPOLOGY_ID); }
@Override public <T extends DataObject> Optional<T> read(@Nonnull final InstanceIdentifier<T> currentId) { try (ReadOnlyTransaction tx = contextBindingBrokerDependency.newReadOnlyTransaction()) { try { return tx.read(LogicalDatastoreType.OPERATIONAL, currentId).checkedGet(); } catch (ReadFailedException e) { throw new IllegalStateException("Unable to perform read of " + currentId, e); } } }
@Override public List<ListenableFuture<Void>> call() throws Exception { List<ListenableFuture<Void>> futures = new ArrayList<>() ; logger.debug("Invoking Tunnel Monitor Worker tzone = {} enabled {}",tzone,enabled ); WriteTransaction t = dataBroker.newWriteOnlyTransaction(); toggleTunnelMonitoring(hwVteps,enabled,tzone,t,exists); futures.add(t.submit()); return futures; }
public OpenFlowDeviceDriver(DataBroker dataBroker, RpcProviderRegistry rpcRegistry) { this.rpcRegistry = Preconditions.checkNotNull(rpcRegistry); // register listener for Node, in future should be filtered by device type // subscribe to be notified when a device-type augmentation is applied to an inventory node dataChangeListenerRegistration = dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, PATH, this, AsyncDataBroker.DataChangeScope.BASE); }
@Override public ListenerRegistration<MeterForwarder> call() throws Exception { return db.registerDataTreeChangeListener(treeId, MeterForwarder.this); } });
/** * {@inheritDoc} */ @Override public ReadWriteTransaction getReadWriteTransaction() { ReadWriteTransaction tx = transaction; if (tx == null) { tx = vtnProvider.getDataBroker().newReadWriteTransaction(); transaction = tx; } return tx; }
public TransactionInvokerImpl(DataBroker db) { this.db = db; this.chain = db.createTransactionChain(this); ThreadFactory threadFact = new ThreadFactoryBuilder().setNameFormat("transaction-invoker-impl-%d").build(); executor = Executors.newSingleThreadExecutor(threadFact); executor.submit(this); }
private <T extends DataObject> Optional<T> read(LogicalDatastoreType datastoreType, InstanceIdentifier<T> path) { ReadOnlyTransaction tx = broker.newReadOnlyTransaction(); Optional<T> result = Optional.absent(); try { result = tx.read(datastoreType, path).get(); } catch (Exception e) { throw new RuntimeException(e); } return result; }
@Override public void merge(LogicalDatastoreType type, InstanceIdentifier<DataObject> id, DataObject data, FutureCallback<Object> callback) { if (dataProvider == null) { LOG.error("Data Service is not initialized!"); return; } writeTransaction = dataProvider.newWriteOnlyTransaction(); writeTransaction.merge(type, id, data); Futures.addCallback(writeTransaction.submit(), callback); }
private void registerListner(final EventSourceTopology eventSourceTopology) { this.listenerRegistration = eventSourceTopology.getDataBroker().registerDataChangeListener( LogicalDatastoreType.OPERATIONAL, EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH, this, DataBroker.DataChangeScope.SUBTREE); }
@Override public ListenerRegistration<FlowNodeReconciliationImpl> call() throws Exception { return dataBroker.registerDataTreeChangeListener(treeId, FlowNodeReconciliationImpl.this); } });
private Optional<TerminationPoint> readTp() throws Exception { if (lportIid != null) { ReadWriteTransaction trans = databroker.newReadWriteTransaction(); return trans.read(LogicalDatastoreType.OPERATIONAL, lportIid).get(); } else { return Optional.absent(); } } }