在windows下先运行server.bat,然后再启动client.bat,在client.bat可以执行以下命令(执行help就会出现以下命令):
Commands:
-- General commands
echo true|false //turns on/off echo of commands (default fa
lse)
silent true|false //turns on/off silent of command output (de
fault false)
#<number> <command> //repeats <number> time <command>, replace
$i in <command> with current iteration (0..<number-1>)
&<number> <command> //forks <number> threads to execute <comman
d>, replace $t in<command> with current thread number (0..<number-1>
When using #x or &x, is is advised to use silent true as well.
When using &x with m.putmany and m.removemany, each thread will get a diffe
rent share of keys unless a start key index is specified
jvm //displays info about the runtime
who //displays info about the cluster
whoami //displays info about this cluster member
ns <string> //switch the namespace for using the distri
buted queue/map/set/list
-- Queue commands
q.offer <string> //adds a string object to the queue
q.poll //takes an object from the queue
q.offermany <number> [<size>]
o the queue ('obj<i>' or byte[<size>])
//adds indicated number of string objects t
q.pollmany <number> //takes indicated number of objects from th
e queue
q.iterator [remove] //iterates the queue, remove if specified
q.size //size of the queue
q.clear //clears the queue
-- Set commands
s.add <string> //adds a string object to the set
s.remove <string> //removes the string object from the set
s.addmany <number>
o the set ('obj<i>')
//adds indicated number of string objects t
s.removemany <number> //takes indicated number of objects from th
e set
s.iterator [remove] //iterates the set, removes if specified
s.size //size of the set
s.clear //clears the set
-- Lock commands
lock <key> //same as Hazelcast.getLock(key).lock()
tryLock <key> //same as Hazelcast.getLock(key).tryLock()
tryLock <key> <time> //same as tryLock <key> with timeout in sec
onds
unlock <key> //same as Hazelcast.getLock(key).unlock()
-- Map commands
m.put <key> <value> //puts an entry to the map
m.remove <key> //removes the entry of given key from the m
ap
m.get <key> //returns the value of given key from the m
ap
m.putmany <number> [<size>] [<index>]//puts indicated number of entries to the m
ap ('key<i>':byte[<size>], <index>+(0..<number>)
m.removemany <number> [<index>] //removes indicated number of entries from
the map ('key<i>', <index>+(0..<number>)
When using &x with m.putmany and m.removemany, each thread will get a diffe
rent share of keys unless a start key <index> is specified
m.keys //iterates the keys of the map
m.values //iterates the values of the map
m.entries //iterates the entries of the map
m.iterator [remove] //iterates the keys of the map, remove if s
pecified
m.size //size of the map
m.clear //clears the map
m.destroy //destroys the map
m.lock <key> //locks the key
m.tryLock <key> //tries to lock the key and returns immedia
tely
m.tryLock <key> <time> //tries to lock the key within given second
s
m.unlock <key> //unlocks the key
-- List commands:
l.add <string>
l.add <index> <string>
l.contains <string>
l.remove <string>
l.remove <index>
l.set <index> <string>
l.iterator [remove]
l.size
l.clear
-- AtomicNumber commands:
a.get
a.set <long>
a.inc
a.dec
-- Executor Service commands:
execute <echo-input>//executes an echo task on rando
m member
execute0nKey <echo-input> <key> //executes an echo task on the m
ember that owns the given key
execute0nMember <echo-input> <key> //executes an echo task on the member wi
th given index
execute0nMembers <echo-input> //executes an echo task on all of the me
mbers
同理在linux也照样能执行相关操作,只是把server.bat和client.bat改成server.sh和client.sh
遗留点问题:
q.offermany 这个命令怎么执行添加多个对象呢? 求解