Search in sources :

Example 1 with PerKeyLockContainer

use of org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer in project infinispan by infinispan.

the class AsyncStoreStressTest method startMarshaller.

@BeforeClass(alwaysRun = true)
void startMarshaller() {
    marshaller = new TestObjectStreamMarshaller();
    location = CommonsTestingUtil.tmpDirectory(this.getClass());
    nonBlockingExecutor = new ThreadPoolExecutor(0, ProcessorInfo.availableProcessors() * 2, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(KnownComponentNames.getDefaultQueueSize(KnownComponentNames.NON_BLOCKING_EXECUTOR)), new NonBlockingThreadFactory("ISPN-non-blocking-thread-group", Thread.NORM_PRIORITY, DefaultThreadFactory.DEFAULT_PATTERN, "Test", "non-blocking"), NonBlockingRejectedExecutionHandler.getInstance());
    blockingExecutor = new ThreadPoolExecutor(0, 150, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(KnownComponentNames.getDefaultQueueSize(KnownComponentNames.BLOCKING_EXECUTOR)), getTestThreadFactory("Blocking"), BlockingRejectedExecutionHandler.getInstance());
    PerKeyLockContainer lockContainer = new PerKeyLockContainer();
    TestingUtil.inject(lockContainer, new DefaultTimeService());
    locks = lockContainer;
    timeService = new DefaultTimeService();
    TestingUtil.inject(locks, timeService, nonBlockingExecutor);
}
Also used : PerKeyLockContainer(org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) NonBlockingThreadFactory(org.infinispan.factories.threads.NonBlockingThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) TestObjectStreamMarshaller(org.infinispan.marshall.TestObjectStreamMarshaller) DefaultTimeService(org.infinispan.commons.time.DefaultTimeService) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with PerKeyLockContainer

use of org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer in project infinispan by infinispan.

the class LockContainerTest method testSingleCounterTestPerEntry.

public void testSingleCounterTestPerEntry() throws ExecutionException, InterruptedException {
    PerKeyLockContainer lockContainer = new PerKeyLockContainer();
    TestingUtil.inject(lockContainer, AbstractCacheTest.TIME_SERVICE);
    doSingleCounterTest(lockContainer, -1);
}
Also used : PerKeyLockContainer(org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer)

Example 3 with PerKeyLockContainer

use of org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer in project infinispan by infinispan.

the class LockManagerTest method testSingleCounterPerKey.

public void testSingleCounterPerKey() throws ExecutionException, InterruptedException {
    DefaultLockManager lockManager = new DefaultLockManager();
    PerKeyLockContainer lockContainer = new PerKeyLockContainer();
    TestingUtil.inject(lockContainer, AbstractCacheTest.TIME_SERVICE);
    TestingUtil.inject(lockManager, lockContainer, named(NON_BLOCKING_EXECUTOR, asyncExecutor), named(TIMEOUT_SCHEDULE_EXECUTOR, mockScheduledExecutor));
    doSingleCounterTest(lockManager);
}
Also used : PerKeyLockContainer(org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer) DefaultLockManager(org.infinispan.util.concurrent.locks.impl.DefaultLockManager)

Example 4 with PerKeyLockContainer

use of org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer in project infinispan by infinispan.

the class LockContainerTest method testSingleLockWithPerEntry.

public void testSingleLockWithPerEntry() throws InterruptedException {
    PerKeyLockContainer lockContainer = new PerKeyLockContainer();
    TestingUtil.inject(lockContainer, AbstractCacheTest.TIME_SERVICE);
    doSingleLockTest(lockContainer, -1);
}
Also used : PerKeyLockContainer(org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer)

Example 5 with PerKeyLockContainer

use of org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer in project infinispan by infinispan.

the class LockManagerTest method testTimeoutPerKey.

public void testTimeoutPerKey() throws ExecutionException, InterruptedException {
    DefaultLockManager lockManager = new DefaultLockManager();
    PerKeyLockContainer lockContainer = new PerKeyLockContainer();
    TestingUtil.inject(lockContainer, AbstractCacheTest.TIME_SERVICE);
    TestingUtil.inject(lockManager, lockContainer, asyncExecutor, mockScheduledExecutor);
    doTestWithFailAcquisition(lockManager);
}
Also used : PerKeyLockContainer(org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer) DefaultLockManager(org.infinispan.util.concurrent.locks.impl.DefaultLockManager)

Aggregations

PerKeyLockContainer (org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer)6 DefaultLockManager (org.infinispan.util.concurrent.locks.impl.DefaultLockManager)3 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 DefaultTimeService (org.infinispan.commons.time.DefaultTimeService)1 NonBlockingThreadFactory (org.infinispan.factories.threads.NonBlockingThreadFactory)1 TestObjectStreamMarshaller (org.infinispan.marshall.TestObjectStreamMarshaller)1 BeforeClass (org.testng.annotations.BeforeClass)1