use of org.apache.ignite.internal.thread.NamedThreadFactory in project ignite-3 by apache.
the class ItJraftCounterServerTest method before.
/**
* Before each.
*/
@BeforeEach
void before() {
LOG.info(">>>>>>>>>>>>>>> Start test method: {}", testInfo.getTestMethod().orElseThrow().getName());
executor = new ScheduledThreadPoolExecutor(20, new NamedThreadFactory(Loza.CLIENT_POOL_NAME));
}
use of org.apache.ignite.internal.thread.NamedThreadFactory in project ignite-3 by apache.
the class SingleThreadExecutorBenchmark method defaultSingleThreadPollExecutorWithMpscBlockingQueue.
@Benchmark
public void defaultSingleThreadPollExecutorWithMpscBlockingQueue() throws InterruptedException {
ThreadPoolExecutor pool = //
ThreadPoolUtil.newBuilder().coreThreads(//
1).maximumThreads(//
1).poolName(//
"default").enableMetric(//
false).workQueue(// TODO asch IGNITE-15997
new MpscBlockingConsumerArrayQueue<>(TIMES)).keepAliveSeconds(//
60L).threadFactory(//
new NamedThreadFactory("default", true)).build();
execute(new DefaultSingleThreadExecutor(pool));
}
use of org.apache.ignite.internal.thread.NamedThreadFactory in project ignite-3 by apache.
the class ItInternalTableScanTest method setUp.
/**
* Prepare test environment.
* <ol>
* <li>Start network node.</li>
* <li>Start raft server.</li>
* <li>Prepare partitioned raft group.</li>
* <li>Prepare partitioned raft group service.</li>
* <li>Prepare internal table as a test object.</li>
* </ol>
*
* @throws Exception If any.
*/
@BeforeEach
public void setUp(TestInfo testInfo) throws Exception {
NetworkAddress nodeNetworkAddress = new NetworkAddress("localhost", 20_000);
network = ClusterServiceTestUtils.clusterService(testInfo, 20_000, new StaticNodeFinder(List.of(nodeNetworkAddress)), NETWORK_FACTORY);
network.start();
raftSrv = new RaftServerImpl(network, FACTORY);
raftSrv.start();
String grpName = "test_part_grp";
List<Peer> conf = List.of(new Peer(nodeNetworkAddress));
mockStorage = mock(PartitionStorage.class);
txManager = new TxManagerImpl(network, new HeapLockManager());
txManager.start();
UUID tblId = UUID.randomUUID();
raftSrv.startRaftGroup(grpName, new PartitionListener(tblId, new VersionedRowStore(mockStorage, txManager) {
@Override
protected Pair<BinaryRow, BinaryRow> versionedRow(@Nullable DataRow row, Timestamp timestamp) {
// Return as is.
return new Pair<>(new ByteBufferRow(row.valueBytes()), null);
}
}), conf);
executor = new ScheduledThreadPoolExecutor(20, new NamedThreadFactory(Loza.CLIENT_POOL_NAME));
RaftGroupService raftGrpSvc = RaftGroupServiceImpl.start(RAFT_GRP_ID, network, FACTORY, 10_000, conf, true, 200, executor).get(3, TimeUnit.SECONDS);
internalTbl = new InternalTableImpl(TEST_TABLE_NAME, tblId, Int2ObjectMaps.singleton(0, raftGrpSvc), 1, NetworkAddress::toString, txManager, mock(TableStorage.class));
}
use of org.apache.ignite.internal.thread.NamedThreadFactory in project ignite-3 by apache.
the class DefaultFixedThreadsExecutorGroupFactory method newExecutorGroup.
@Override
public FixedThreadsExecutorGroup newExecutorGroup(final int nThreads, final String poolName, final int maxPendingTasksPerThread, final boolean useMpscQueue) {
Requires.requireTrue(nThreads > 0, "nThreads must > 0");
final boolean mpsc = useMpscQueue && Utils.USE_MPSC_SINGLE_THREAD_EXECUTOR;
final SingleThreadExecutor[] children = new SingleThreadExecutor[nThreads];
final ThreadFactory threadFactory = mpsc ? new NamedThreadFactory(poolName, true) : null;
for (int i = 0; i < nThreads; i++) {
if (mpsc) {
children[i] = new MpscSingleThreadExecutor(maxPendingTasksPerThread, threadFactory);
} else {
children[i] = new DefaultSingleThreadExecutor(poolName, maxPendingTasksPerThread);
}
}
return new DefaultFixedThreadsExecutorGroup(children);
}
use of org.apache.ignite.internal.thread.NamedThreadFactory in project ignite-3 by apache.
the class ItMetaStorageRaftGroupTest method beforeTest.
/**
* Run {@code NODES} cluster nodes.
*/
@BeforeEach
public void beforeTest(TestInfo testInfo) {
List<NetworkAddress> localAddresses = findLocalAddresses(NODE_PORT_BASE, NODE_PORT_BASE + NODES);
var nodeFinder = new StaticNodeFinder(localAddresses);
localAddresses.stream().map(addr -> ClusterServiceTestUtils.clusterService(testInfo, addr.port(), nodeFinder, NETWORK_FACTORY)).forEach(clusterService -> {
clusterService.start();
cluster.add(clusterService);
});
for (ClusterService node : cluster) {
assertTrue(waitForTopology(node, NODES, 1000));
}
LOG.info("Cluster started.");
executor = new ScheduledThreadPoolExecutor(20, new NamedThreadFactory(Loza.CLIENT_POOL_NAME));
}
Aggregations