Search in sources :

Example 1 with BlockingManagerImpl

use of org.infinispan.util.concurrent.BlockingManagerImpl 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;
}
Also used : BlockingManagerImpl(org.infinispan.util.concurrent.BlockingManagerImpl) DummyInitializationContext(org.infinispan.persistence.DummyInitializationContext) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ByteBufferFactoryImpl(org.infinispan.commons.io.ByteBufferFactoryImpl) BlockingManager(org.infinispan.util.concurrent.BlockingManager) TestComponentAccessors(org.infinispan.factories.impl.TestComponentAccessors) DefaultTimeService(org.infinispan.commons.time.DefaultTimeService) MarshalledEntryFactoryImpl(org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl) AsyncNonBlockingStore(org.infinispan.persistence.async.AsyncNonBlockingStore) Cache(org.infinispan.Cache)

Aggregations

Cache (org.infinispan.Cache)1 ByteBufferFactoryImpl (org.infinispan.commons.io.ByteBufferFactoryImpl)1 DefaultTimeService (org.infinispan.commons.time.DefaultTimeService)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 TestComponentAccessors (org.infinispan.factories.impl.TestComponentAccessors)1 MarshalledEntryFactoryImpl (org.infinispan.marshall.persistence.impl.MarshalledEntryFactoryImpl)1 DummyInitializationContext (org.infinispan.persistence.DummyInitializationContext)1 AsyncNonBlockingStore (org.infinispan.persistence.async.AsyncNonBlockingStore)1 BlockingManager (org.infinispan.util.concurrent.BlockingManager)1 BlockingManagerImpl (org.infinispan.util.concurrent.BlockingManagerImpl)1