Created
February 10, 2014 13:39
-
-
Save gurbuzali/8916106 to your computer and use it in GitHub Desktop.
3.1.5
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
| static void testContainsKey() throws InterruptedException { | |
| final Config config = new Config(); | |
| final MapConfig mapConfig = config.getMapConfig("m"); | |
| mapConfig.setTimeToLiveSeconds(900); | |
| mapConfig.setNearCacheConfig(new NearCacheConfig().setTimeToLiveSeconds(900)); | |
| final HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config); | |
| final HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config); | |
| instance1.getMap("m").put("key", "value"); | |
| final Thread t = new Thread() { | |
| @Override | |
| public void run() { | |
| final IMap<Object, Object> m = instance2.getMap("m"); | |
| while (!Thread.currentThread().isInterrupted()) { | |
| final boolean key = m.containsKey("key"); | |
| System.err.println("contains: " + key); | |
| } | |
| } | |
| }; | |
| t.start(); | |
| Thread.sleep(1000); | |
| instance1.getLifecycleService().terminate(); | |
| Thread.sleep(10000); | |
| t.interrupt(); | |
| t.join(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment