To create a cluster-wide, named mutex, simply lock a key in a cache with an infinite wait time. Note that a key can be locked even though the key does not actually exist in the cache. This example implements a non-recursive mutex.
String sMutexName = "myNamedMutex";
NamedCache cache = CacheFactory.getCache(sCacheName);
try
{
cache.lock(sMutexName, -1);
[COH33UG:...]
}
finally
{
cache.unlock(sMutexName);
}