@Test public void testHazelcastInstances() { assertNotNull(map1); assertNotNull(map2); assertNotNull(multiMap); assertNotNull(replicatedMap); assertNotNull(queue); assertNotNull(topic); assertNotNull(set); assertNotNull(list); assertNotNull(executorService); assertNotNull(idGenerator); assertNotNull(atomicLong); assertNotNull(atomicReference); assertNotNull(countDownLatch); assertNotNull(semaphore); assertNotNull(lock); assertEquals("map1", map1.getName()); assertEquals("map2", map2.getName()); assertEquals("testMultimap", multiMap.getName()); assertEquals("replicatedMap", replicatedMap.getName()); assertEquals("testQ", queue.getName()); assertEquals("testTopic", topic.getName()); assertEquals("set", set.getName()); assertEquals("list", list.getName()); assertEquals("idGenerator", idGenerator.getName()); assertEquals("atomicLong", atomicLong.getName()); assertEquals("atomicReference", atomicReference.getName()); assertEquals("countDownLatch", countDownLatch.getName()); assertEquals("semaphore", semaphore.getName()); }
/** * Constructs the consumer which will read from the given destination and is a child of the given * context. * * @param destination the destination that this consumer will read from * @param hazelcastMQContext the parent context of this consumer */ DefaultHazelcastMQConsumer(String destination, DefaultHazelcastMQContext hazelcastMQContext) { super(); this.destination = destination; this.receiveLock = new ReentrantLock(); this.receiveCondition = receiveLock.newCondition(); this.closed = false; this.active = false; this.hazelcastMQContext = hazelcastMQContext; this.config = hazelcastMQContext.getHazelcastMQInstance().getConfig(); HazelcastInstance hazelcast = this.hazelcastMQContext.getHazelcastMQInstance().getConfig().getHazelcastInstance(); IdGenerator idGenerator = hazelcast.getIdGenerator("hazelcastmqconsumer"); this.id = "hazelcastmqconsumer-" + String.valueOf(idGenerator.newId()); }