use of com.hazelcast.map.MapStoreFactory in project hazelcast by hazelcast.
the class StoreConstructor method getStoreFromFactoryOrNull.
private static Object getStoreFromFactoryOrNull(String name, MapStoreConfig mapStoreConfig, ClassLoader classLoader) {
MapStoreFactory factory = (MapStoreFactory) mapStoreConfig.getFactoryImplementation();
if (factory == null) {
final String factoryClassName = mapStoreConfig.getFactoryClassName();
if (isNullOrEmpty(factoryClassName)) {
return null;
}
try {
factory = ClassLoaderUtil.newInstance(classLoader, factoryClassName);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
if (factory == null) {
return null;
}
final Properties properties = mapStoreConfig.getProperties();
return factory.newMapStore(name, properties);
}
use of com.hazelcast.map.MapStoreFactory in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testAttributesConfigWithStoreFactoryImplementation.
@Test
public void testAttributesConfigWithStoreFactoryImplementation() {
MapStoreConfig mapStoreConfig = new MapStoreConfig().setEnabled(true).setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER).setWriteDelaySeconds(10).setWriteCoalescing(true).setWriteBatchSize(500).setFactoryImplementation((MapStoreFactory<Object, Object>) (mapName, properties) -> null).setProperty("key", "value");
testMap(mapStoreConfig);
}
Aggregations