This appendix describes the commands that can be issued to the Coherence command line application
coherence.sh on UNIX).
You can script Coherence from the command line by creating a separate file with command-line commands. For example, you can create a file called
batchfile.txt which contains commands to change the current cache to
testcache, clear it, and then exit:
cache testcache clear bye
You can invoke this script on the UNIX platform by running the Coherence command line application:
bin/coherence.sh "@batch batchfile.txt"
On the Windows platform, substitute
Populates the current
NamedCache with the specified number of objects. This is best described with an example:
bulkput 1000 10000 1
This will put 1000 objects of size 10000 bytes (10 MB total) starting with key 1 into the cache. The type of the key will be
java.lang.Integer and the type of the value is
byte. (The one exception is for the size zero, the value is of type
Coherence$DebugCacheItem, which is used to test custom serialization and
Gracefully shuts down the cluster member and closes the Coherence command-line application. To test "ungraceful" shutdown, use
Ctrl+C (Windows or UNIX) or
<pid> on UNIX.
destroy on the current
NamedCache. This will remove the
NamedCache completely from the cluster, causing other cluster members to receive an
IllegalStateException if they are holding on to a reference to the same cache and try to do any operation on that cache.
Returns a hash value of the
NamedCache. This is similar to a checksum and is mainly used for verifying the equivalency of the replicated caches.
Increments the specified key the specified number of times, using locking to ensure that no "missing updates" occur. For example:
inc counter 10000
This will increment the
counter key 10000 times. If you run this command simultaneously on 10 machines, the value of the
counter key will be 100,000 (assuming it started at 0 or did not exist previously).
Shuts down the current
com.tangosol.net.CacheService in an orderly (graceful) manner. This does not affect other service members.
Lists the contents of the specified
NamedCache, or the current one if none is specified.
If there are more than 50 items in the
NamedCache only the first 50 items will be displayed through the
Java implements the
toString method for
byte values as
[ (that is, array) +
B (that is, byte) +
hashcode. For example:
start) or unregisters (
stop) a debug implementation of
com.tangosol.util.MapListener with the current
cluster) or with the "backing-store"
local). (The backing store is the
java.util.Map object obtained by the cache service from the
For partitioned caches, the
local listener can only be used on storage-enabled nodes. For example, with the partitioned cache service, this command will show all cache changes that this member manages:
listen start local
This command will show all cache changes, even if they are managed by a different member, and even if this member has
local-storage-enabled set to
listen start cluster
Locks the specified key. If the lock cannot be obtained immediately, it returns
false, unless a time-out has been specified. The value is the number of milliseconds, expressed as a
long integer (that is, the value should be suffixed with an “
l”). For example, this command attempts to lock the
counter key for up to 10 seconds:
lock counter 10000l
Lists all the
NamedCache(s) for the current service,
com.tangosol.net.CacheService, regardless of whether they were created by this member.
Lists the "total" used, total "free", and maximum memory values for this JVM. For example:
Map (testcache): memory total=64356K (64356352) free =55658K (55658976) max =64356K (64356352)
Puts the specified key/value pair into the current
NamedCache using the
put(key, value) method.
Releases the reference to the current
NamedCache on this cluster member by calling the
release method. This does not affect other cluster nodes. After calling release, the name of the inactive cache is still shown, because the command line tool still holds the reference to the cache. This is expected behavior. If subsequent commands are issued on this cluster node against the current
IllegalStateException will occur.
Map (testcache): release Map (testcache):
Removes the specified key from the current
NamedCache using the
This method is used to check for missing keys in a sequence. For example, the following command checks the
java.lang.Integer keys from 1 to 1000 inclusive, and prints out any keys in that range that are not present in the current
scan 1 1000
Lists all the services (
com.tangosol.net.Service) known to this cluster. Some of these services may not be currently running on this cluster node.
This method is used in conjunction with multiple Coherence command line processes and the
bulkput command to time cache replication. Before one machine starts its
bulkput command, a second machine is told to wait for the range of keys that will be placed into the cache.
For example, if you run these commands on the first JVM:
clear waitkey 1 1000
Then run this command on the second JVM:
bulkput 1000 100 1
The first JVM will display the total replication time for 1000 entries with values of 100 bytes.
Repeats the following
<command> the specified number of times. Multiple commands can be delimited with a semicolon. For example, in a loop of ten iterations, this command increments the
Counter key, then lists the current
#10 inc Counter; list
Silent mode. Suppresses output from the command. This can be used in conjunction with '
#' (repeat mode). For example, in a loop of ten iterations, this command increments the
Counter key, then lists the current
NamedCache values. The output from the
inc command is suppressed:
#10 @inc Counter; list