Search in sources :

Example 1 with ThreadJobProcessor

use of jetbrains.exodus.core.execution.ThreadJobProcessor in project xodus by JetBrains.

the class StressTests method testConcurrentRead.

public void testConcurrentRead() {
    final StoreTransaction txn = getStoreTransaction();
    createData(txn);
    ThreadJobProcessor[] procs = new ThreadJobProcessor[/*3*/
    2];
    for (int i = 0; i < procs.length; i++) {
        final int ii = i;
        ThreadJobProcessor proc = new ThreadJobProcessor("Processor" + 1);
        procs[i] = proc;
        proc.start();
        for (int j = 0; j < 10; /*00*/
        ++j) {
            final int jj = j;
            new Job(proc) {

                @Override
                protected void execute() throws Throwable {
                    final StoreTransaction s = getEntityStore().beginTransaction();
                    try {
                        final long now = System.currentTimeMillis();
                        s.find("Issue", "summary", "summary0", "summary" + (100 * ii + jj + 10000)).intersect(s.find("Issue", "created", now - 50000, now)).size();
                    } finally {
                        s.commit();
                    }
                }
            };
        }
    }
    for (final ThreadJobProcessor proc : procs) {
        proc.queueFinish();
    }
    for (ThreadJobProcessor proc : procs) {
        proc.waitUntilFinished();
    }
}
Also used : Job(jetbrains.exodus.core.execution.Job) ThreadJobProcessor(jetbrains.exodus.core.execution.ThreadJobProcessor)

Example 2 with ThreadJobProcessor

use of jetbrains.exodus.core.execution.ThreadJobProcessor in project xodus by JetBrains.

the class EnvironmentTestsBase method setUp.

@Before
public void setUp() throws Exception {
    invalidateSharedCaches();
    final Pair<DataReader, DataWriter> readerWriterPair = createRW();
    reader = readerWriterPair.getFirst();
    writer = readerWriterPair.getSecond();
    createEnvironment();
    processor = new ThreadJobProcessor("EnvironmentTestsBase processor");
    processor.start();
}
Also used : ThreadJobProcessor(jetbrains.exodus.core.execution.ThreadJobProcessor) Before(org.junit.Before)

Aggregations

ThreadJobProcessor (jetbrains.exodus.core.execution.ThreadJobProcessor)2 Job (jetbrains.exodus.core.execution.Job)1 Before (org.junit.Before)1