use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class NettyThreadgroupModuleTest method testReconfigure.
@Test
public void testReconfigure() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException, InstanceNotFoundException {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
createInstance(transaction, instanceName, null);
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
NettyThreadgroupModuleMXBean mxBean = transaction.newMBeanProxy(transaction.lookupConfigBean(AbstractNettyThreadgroupModuleFactory.NAME, instanceName), NettyThreadgroupModuleMXBean.class);
mxBean.setThreadCount(1);
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
assertStatus(status, 0, 1, 0);
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class BlankTransactionServiceTracker method blankTransactionSync.
void blankTransactionSync() {
// race condition check: config-persister might push new configuration while
// server is starting up.
ConflictingVersionException lastException = null;
for (int i = 0; i < maxAttempts; i++) {
try {
// create transaction
CommitStatus commitStatus = blankTransaction.hit();
LOG.debug("Committed blank transaction with status {}", commitStatus);
return;
} catch (final ConflictingVersionException e) {
lastException = e;
try {
Thread.sleep(1000);
} catch (final InterruptedException interruptedException) {
Thread.currentThread().interrupt();
LOG.debug("blankTransactionSync was interrupted");
return;
}
} catch (final ValidationException e) {
LOG.error("Validation exception while running blank transaction indicates programming error", e);
}
}
LOG.error("Maximal number of attempts reached and still cannot get optimistic lock from config manager", lastException);
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class JMXNotifierConfigRegistry method commitConfig.
@Override
public CommitStatus commitConfig(final ObjectName transactionControllerON) throws ConflictingVersionException, ValidationException {
final CommitStatus commitStatus = delegate.commitConfig(transactionControllerON);
notifier.notifyCommit(ObjectNameUtil.getTransactionName(transactionControllerON));
return commitStatus;
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class BlankTransactionServiceTrackerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
doReturn(new CommitStatus(Collections.<ObjectName>emptyList(), Collections.<ObjectName>emptyList(), Collections.<ObjectName>emptyList())).when(blankTx).hit();
tracker = new BlankTransactionServiceTracker(blankTx, 10, MoreExecutors.newDirectExecutorService());
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class SimpleConfigurationTest method test_createThreadPool_changeNumberOfThreads.
@Test
public void test_createThreadPool_changeNumberOfThreads() throws Exception {
firstCommit();
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
TestingFixedThreadPoolConfigMXBean fixedConfigProxy = startReconfiguringFixed1ThreadPool(transaction);
assertEquals(NUMBER_OF_THREADS, fixedConfigProxy.getThreadCount());
fixedConfigProxy.setThreadCount(NUMBER_OF_THREADS2);
CommitStatus commitStatus = transaction.commit();
checkThreadPools(1, NUMBER_OF_THREADS2);
CommitStatus expected = new CommitStatus(EMPTYO_NS, FIXED1_LIST, EMPTYO_NS);
assertEquals(expected, commitStatus);
}
Aggregations