Search in sources :

Example 1 with IdHolder

use of org.opendaylight.genius.idmanager.IdHolder in project genius by opendaylight.

the class IdHolderSyncJob method call.

@Override
public List<ListenableFuture<Void>> call() {
    IdPoolBuilder idPool = new IdPoolBuilder().setKey(new IdPoolKey(localPoolName));
    idHolder.refreshDataStore(idPool);
    InstanceIdentifier<IdPool> localPoolInstanceIdentifier = idUtils.getIdPoolInstance(localPoolName);
    return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
        tx.merge(CONFIGURATION, localPoolInstanceIdentifier, idPool.build(), true);
        idUtils.incrementPoolUpdatedMap(localPoolName);
        if (LOG.isDebugEnabled()) {
            LOG.debug("IdHolder synced {}", idHolder);
        }
    }));
}
Also used : Logger(org.slf4j.Logger) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) IdPool(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) LoggerFactory(org.slf4j.LoggerFactory) CONFIGURATION(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION) Callable(java.util.concurrent.Callable) IdUtils(org.opendaylight.genius.idmanager.IdUtils) List(java.util.List) IdHolder(org.opendaylight.genius.idmanager.IdHolder) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IdPoolKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey) IdPoolBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolBuilder) Collections(java.util.Collections) IdPoolBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolBuilder) IdPoolKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey) IdPool(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool)

Aggregations

ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 Collections (java.util.Collections)1 List (java.util.List)1 Callable (java.util.concurrent.Callable)1 CONFIGURATION (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION)1 IdHolder (org.opendaylight.genius.idmanager.IdHolder)1 IdUtils (org.opendaylight.genius.idmanager.IdUtils)1 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)1 IdPool (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool)1 IdPoolBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolBuilder)1 IdPoolKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPoolKey)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1