import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Executor;
-
import javax.management.ObjectName;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
ClassBasedModuleFactory mockedThreadPoolConfigFactory = new ClassBasedModuleFactory(
threadPoolImplementationName, MockedThreadPoolModule.class);
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,
new TestingParallelAPSPModuleFactory(),
mockedThreadPoolConfigFactory));
}
- public static interface MockedTestingThreadPoolConfigMXBean extends
+ public interface MockedTestingThreadPoolConfigMXBean extends
TestingThreadPoolConfigMXBean {
- public void setThreadCount(int threadCount);
+ void setThreadCount(int threadCount);
}
public static class MockedThreadPoolModule implements Module,
int threadCount;
public MockedThreadPoolModule(
- DynamicMBeanWithInstance dynamicMBeanWithInstance, ModuleIdentifier moduleIdentifier) {
+ final DynamicMBeanWithInstance dynamicMBeanWithInstance, final ModuleIdentifier moduleIdentifier) {
// no reconfiguration / reuse is supported
this.moduleIdentifier = moduleIdentifier;
}
}
@Override
- public void setThreadCount(int threadCount) {
+ public void setThreadCount(final int threadCount) {
this.threadCount = threadCount;
}
}
+ @Override
+ public boolean canReuse(final Module oldModule) {
+ return false;
+ }
+
@Override
public Closeable getInstance() {
return new MockedThreadPool(threadCount);
Closeable {
private final int threadCount;
- public MockedThreadPool(int threadCount) {
+ public MockedThreadPool(final int threadCount) {
this.threadCount = threadCount;
}
}
@Override
- String getThreadPoolImplementationName() {
+ protected String getThreadPoolImplementationName() {
return threadPoolImplementationName;
}