Search in sources :

Example 1 with GroupedDaemonThreadFactory

use of org.neo4j.kernel.impl.scheduler.GroupedDaemonThreadFactory in project neo4j by neo4j.

the class IndexingServiceTest method latchedIndexPopulation.

private AtomicReference<BinaryLatch> latchedIndexPopulation() {
    AtomicReference<BinaryLatch> populationStartLatch = new AtomicReference<>(new BinaryLatch());
    scheduler.setThreadFactory(Group.INDEX_POPULATION, (group, parent) -> new GroupedDaemonThreadFactory(group, parent) {

        @Override
        public Thread newThread(Runnable job) {
            return super.newThread(() -> {
                populationStartLatch.get().await();
                job.run();
            });
        }
    });
    return populationStartLatch;
}
Also used : GroupedDaemonThreadFactory(org.neo4j.kernel.impl.scheduler.GroupedDaemonThreadFactory) AtomicReference(java.util.concurrent.atomic.AtomicReference) BinaryLatch(org.neo4j.util.concurrent.BinaryLatch)

Aggregations

AtomicReference (java.util.concurrent.atomic.AtomicReference)1 GroupedDaemonThreadFactory (org.neo4j.kernel.impl.scheduler.GroupedDaemonThreadFactory)1 BinaryLatch (org.neo4j.util.concurrent.BinaryLatch)1