use of org.infinispan.commons.time.DefaultTimeService 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);
}
use of org.infinispan.commons.time.DefaultTimeService in project infinispan by infinispan.
the class AsyncStoreStressTest method createAsyncStore.
private AsyncNonBlockingStore<Object, Object> createAsyncStore(NonBlockingStore backendStore, StoreConfiguration storeConfiguration) throws PersistenceException {
AsyncNonBlockingStore<Object, Object> store = new AsyncNonBlockingStore<>(backendStore);
BlockingManager blockingManager = new BlockingManagerImpl();
TestingUtil.inject(blockingManager, new TestComponentAccessors.NamedComponent(KnownComponentNames.NON_BLOCKING_EXECUTOR, nonBlockingExecutor), new TestComponentAccessors.NamedComponent(KnownComponentNames.BLOCKING_EXECUTOR, blockingExecutor));
TestingUtil.startComponent(blockingManager);
Cache cacheMock = Mockito.mock(Cache.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(cacheMock.getAdvancedCache().getComponentRegistry().getComponent(KeyPartitioner.class)).thenReturn(SingleSegmentKeyPartitioner.getInstance());
CompletionStages.join(store.start(new DummyInitializationContext(storeConfiguration, cacheMock, marshaller, new ByteBufferFactoryImpl(), new MarshalledEntryFactoryImpl(marshaller), nonBlockingExecutor, new GlobalConfigurationBuilder().globalState().persistentLocation(location).build(), blockingManager, null, new DefaultTimeService())));
return store;
}
Aggregations