com.hazelcast.core.MultiMap.lock()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中com.hazelcast.core.MultiMap.lock()方法的一些代码示例,展示了MultiMap.lock()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.lock()方法的具体详情如下:
包路径:com.hazelcast.core.MultiMap
类名称:MultiMap
方法名:lock

MultiMap.lock介绍

[英]Acquires a lock for the specified key.

If the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.

The scope of the lock is for this multimap only. The acquired lock is only for the key in this multimap.

Locks are re-entrant, so if the key is locked N times, then it should be unlocked N times before another thread can acquire it.

Warning: This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equals defined in the key's class.
[中]获取指定密钥的锁。
如果锁不可用,则出于线程调度目的,当前线程将被禁用,并处于休眠状态,直到获得锁为止。
锁定范围仅适用于此多重贴图。获取的锁仅用于此多重映射中的密钥。
锁是可重入的,因此如果密钥被锁定N次,那么在另一个线程获取它之前,它应该被解锁N次。
警告:此方法使用密钥二进制形式的hashCode和equals,而不是密钥类中定义的hashCode和equals的实际实现。

代码示例

代码示例来源:origin: dCache/nfs4j

@Override
public void lock() {
  locks.lock(key);
}

代码示例来源:origin: hazelcast/hazelcast-jet

protected void handleMultiMapLock(String[] args) {
  getMultiMap().lock(args[1]);
  println("true");
}

代码示例来源:origin: com.hazelcast/hazelcast-all

protected void handleMultiMapLock(String[] args) {
  getMultiMap().lock(args[1]);
  println("true");
}

代码示例来源:origin: hazelcast/hazelcast-jet

protected void handleMultiMapLock(String[] args) {
  getMultiMap().lock(args[1]);
  println("true");
}

代码示例来源:origin: com.hazelcast/hazelcast-all

protected void handleMultiMapLock(String[] args) {
  getMultiMap().lock(args[1]);
  println("true");
}

代码示例来源:origin: com.thinkaurelius.titan/titan-hazelcast

cache.lock(rawKey);

代码示例来源:origin: com.thinkaurelius.titan/titan-hazelcast

cache.lock(rawKey);
  columns = Lists.newArrayList(cache.get(rawKey));
} finally {

相关文章