- private String containerName = null;
-
- private IClusterContainerServices clusterContainerService = null;
- private ConcurrentMap<String, NeutronFloatingIP> floatingIPDB;
-
- // methods needed for creating caches
-
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- this.clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (this.clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- this.clusterContainerService = null;
- }
- }
-
- @SuppressWarnings("deprecation")
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron FloatingIPs");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronFloatingIPs",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for NeutronFloatingIps");
- }
-
- @SuppressWarnings({ "unchecked", "deprecation" })
- private void retrieveCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron FloatingIPs");
- floatingIPDB = (ConcurrentMap<String, NeutronFloatingIP>) this.clusterContainerService
- .getCache("neutronFloatingIPs");
- if (floatingIPDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron FloatingIPs");
- }
- logger.debug("Cache was successfully retrieved for Neutron FloatingIPs");
- }