/** * The distributed map for DistributedMapNames.MAP.FILE_TRACKER_MAP needs to * be added to the MapStoreConfig. * * @param mapStore */ public <T, B> HazelcastStartupService(Configuration conf, MapStore<T, B> mapStore) { super(); this.conf = conf; this.mapStore = mapStore; }
public MyHazelcastInstance(final MapStore store, final String storeType) { this.store = store; this.storeType = storeType; log.info("Creating Hazelcast CEP instance.."); instanceName = UUID.randomUUID().toString(); Hazelcast.newHazelcastInstance(getConfig()); log.info("Created CEP instance."); }
public MapStore getMapStore(String mapName) { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapContainer mc = svc.getMapServiceContext().getMapContainer(mapName); if (mc != null) { MapStoreContext msc = mc.getMapStoreContext(); if (msc != null) { MapStoreWrapper msw = msc.getMapStoreWrapper(); if (msw != null) { return msw.getMapStore(); } } } return null; }
public static void assertMapStoreConfiguration(Logger logger, HazelcastInstance instance, String mapName, Class<? extends MapStore> mapStoreImplementation) { if (isClient(instance)) { return; } String expectedMapStoreName = mapStoreImplementation.getName(); MapStoreConfig mapStoreConfig = instance.getConfig().getMapConfig(mapName).getMapStoreConfig(); assertMapStoreConfig(expectedMapStoreName, mapName, mapStoreConfig, logger); assertMapStoreClassName(expectedMapStoreName, mapName, mapStoreConfig); assertMapStoreImplementation(expectedMapStoreName, mapName, mapStoreConfig, mapStoreImplementation); }
private static void assertMapStoreImplementation(String expectedMapStoreName, String mapName, MapStoreConfig mapStoreConfig, Class<? extends MapStore> mapStoreImplementation) { Object configuredMapStoreImpl = mapStoreConfig.getImplementation(); if (configuredMapStoreImpl == null) { if (mapStoreConfig.getInitialLoadMode().equals(LAZY)) { return; } throw new TestException("MapStore for map %s needs to be initialized with class %s, but was null (%s)", mapName, expectedMapStoreName, mapStoreConfig); } if (!configuredMapStoreImpl.getClass().equals(mapStoreImplementation)) { throw new TestException("MapStore for map %s needs to be initialized with class %s, but was %s (%s)", mapName, expectedMapStoreName, configuredMapStoreImpl.getClass().getName(), mapStoreConfig); } }
/** * Set map store using a spring bean. This is for programmatic configuration of {@linkplain MapStore} * @param backingStore */ public void setMapStoreImplementation(String map, MapStore<? extends Serializable, ? extends Serializable> backingStore) { hzInstance.setMapStoreImplementation(map, backingStore, true); log.info("Set write through backing store for saving ensemble models.."); }