HazelcastInstance.getDistributedObjects() returns empty collection

100 views
Skip to first unread message

anat...@gmail.com

unread,
May 27, 2016, 12:02:24 PM5/27/16
to Hazelcast
version 3.6.1

I am running the below example [SampleDistObjListener] with a non-default cluster.xml.The cluster.xml defines several objects (Maps, etc.). I am expecting to see the list of the object names printed once the Hazelcast instance had started, but I see none.

    Collection<DistributedObject> distributedObjects = hazelcastInstance.getDistributedObjects();
    for (DistributedObject distributedObject : distributedObjects) {
      System.out.println(distributedObject.getName() + "," + distributedObject.getServiceName());
    }

example:
http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#listening-for-distributed-object-events

running as:
java -Dhazelcast.config=cluster.xml -classpath hazelcast-all-3.6.1.jar:. SampleDistObjListener

The objects seem to appear on the list once I "touch" them in the code "hazelcastInstance.getMap(...)" but not until then. Am I incorrect assuming that a Map defined via cluster.xml gets created at start-up?


Any ideas?
Thank you for your response




Peter Veentjer

unread,
May 27, 2016, 1:47:55 PM5/27/16
to haze...@googlegroups.com
Maps get only created when you call them. So if they are in the config; it doesn't trigger their creation.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/fd8a5f79-c33c-4347-b397-b061184616af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages