Scripting through HZ Mancenter

315 views
Skip to first unread message

Javier Arenales Castrodeza

unread,
Jul 30, 2013, 8:40:11 AM7/30/13
to haze...@googlegroups.com, jcga...@orizom.com
Hi folks,

i'm trying to use scripting through mancenter in order to get information from hazelcast map and update it later.

This is my function:

function getHgroups() {
 var map = hazelcast.getMap('hgroups');
 var result;
 
 for (var key in map.keySet()) {
    
    result = result + key + ', ';
 }

 return 'map: ' + map.size() + ' result: ' + result;
}

But, instead of getting keys of that map, I get the next information:

map: 3 result: undefinedkeyValues, notifyAll, removeAll, clearEntries, containsAll, getKeyValues, contains, empty, equals, notify, class, isEmpty, add, size, iterator, clear, wait, retainAll, toString, hashCode, toArray, addEntries, addAll, getClass, remove,...

Any suggestion? Is there anybody who has experience working with mancenter and scripting? 

Thanks,

Javier.

Tim Peierls

unread,
Jul 30, 2013, 8:52:22 AM7/30/13
to haze...@googlegroups.com, jcga...@orizom.com
Try using the iterator methods:

function getHgroups() {
    var map = hazelcast.getMap("hgroups"),
        it = map.keySet().iterator(),
        result,
        key;
    while (it.hasNext()) {
        key = it.next();
        result = result + key + ', ';
    }
    return 'map: ' + map.size() + ' result: ' + result;
}

--tim

--
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 http://groups.google.com/group/hazelcast.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages