use of org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory in project activemq-artemis by apache.
the class NettyFailoverTest method createNodeManager.
@Override
protected NodeManager createNodeManager() throws Exception {
switch(nodeManagerType) {
case InVM:
return new InVMNodeManager(false);
case Jdbc:
final ThreadFactory daemonThreadFactory = t -> {
final Thread th = new Thread(t);
th.setDaemon(true);
return th;
};
final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(daemonThreadFactory);
scheduledExecutorServices.add(scheduledExecutorService);
final ExecutorService executor = Executors.newFixedThreadPool(2, daemonThreadFactory);
executors.add(executor);
final DatabaseStorageConfiguration dbConf = createDefaultDatabaseStorageConfiguration();
final ExecutorFactory executorFactory = new OrderedExecutorFactory(executor);
return JdbcNodeManager.with(dbConf, scheduledExecutorService, executorFactory, (code, message, file) -> {
code.printStackTrace();
Assert.fail(message);
});
default:
throw new AssertionError("enum type not supported!");
}
}
use of org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory in project activemq-artemis by apache.
the class ReplicationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
tFactory = new ActiveMQThreadFactory("ActiveMQ-ReplicationTest", false, this.getClass().getClassLoader());
executor = Executors.newCachedThreadPool(tFactory);
scheduledExecutor = new ScheduledThreadPoolExecutor(10, tFactory);
factory = new OrderedExecutorFactory(executor);
}
use of org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory in project activemq-artemis by apache.
the class JournalFileSizeTest method testIncorrectFileSizeHigher.
@Test
public void testIncorrectFileSizeHigher() {
ConfigurationImpl config = new ConfigurationImpl();
int origFileSize = config.getJournalFileSize();
config.setJournalFileSize(origFileSize + (align / 2 + 1));
JournalStorageManager manager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), new OrderedExecutorFactory(null), new OrderedExecutorFactory(null));
int fileSize = manager.getMessageJournal().getFileSize();
Assert.assertEquals(origFileSize + align, fileSize);
}
use of org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory in project activemq-artemis by apache.
the class JournalFileSizeTest method testIncorrectFileSizeHalf.
@Test
public void testIncorrectFileSizeHalf() {
ConfigurationImpl config = new ConfigurationImpl();
int origFileSize = config.getJournalFileSize();
config.setJournalFileSize(origFileSize + (align / 2));
JournalStorageManager manager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), new OrderedExecutorFactory(null), new OrderedExecutorFactory(null));
int fileSize = manager.getMessageJournal().getFileSize();
Assert.assertEquals(origFileSize + align, fileSize);
}
use of org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory in project activemq-artemis by apache.
the class JournalFileSizeTest method testIncorrectFileSizeLower.
@Test
public void testIncorrectFileSizeLower() {
ConfigurationImpl config = new ConfigurationImpl();
int origFileSize = config.getJournalFileSize();
config.setJournalFileSize(origFileSize + (align / 2 - 1));
JournalStorageManager manager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), new OrderedExecutorFactory(null), new OrderedExecutorFactory(null));
int fileSize = manager.getMessageJournal().getFileSize();
Assert.assertEquals(origFileSize, fileSize);
}
Aggregations