Created
January 15, 2015 09:07
-
-
Save enesakar/8e99c5456606373c3060 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.hazelcast.test; | |
| import com.hazelcast.core.HazelcastInstance; | |
| import com.hazelcast.core.IMap; | |
| import com.hazelcast.core.ISet; | |
| public class MapFactory { | |
| ISet<String> destroyedMapNames; | |
| HazelcastInstance instance; | |
| public MapFactory(HazelcastInstance instance) { | |
| this.instance = instance; | |
| this.destroyedMapNames = instance.getSet("destroyedMapNames"); | |
| } | |
| synchronized IMap getMap(String mapName){ | |
| if(destroyedMapNames.contains(mapName)){ | |
| return null; | |
| } | |
| return instance.getMap(mapName); | |
| } | |
| synchronized void destroy(String mapName) { | |
| if(destroyedMapNames.contains(mapName)){ | |
| return; | |
| } | |
| destroyedMapNames.add(mapName); | |
| instance.getMap(mapName).destroy(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment