0
我使用IMAP做鎖定,下面它是如何在這裏解釋:
https://groups.google.com/forum/#!topic/hazelcast/9YFGh3xwe8I是什麼原因導致Hazelcast map.lock期間拋出一個InterruptedException()
IMap<Object, Object> locks = hazelcastInstance.getMap("locks");
locks.lock(someStr);
try {
//do stuff
} finally {
locks.unlock(someStr);
}
偶爾線
locks.locks(someStr)
導致錯誤
com.hazelcast.core.HazelcastException: java.lang.InterruptedException:
Call BasicInvocation{ serviceName='hz:impl:lockService',op=com.hazelcast.concurrent.lock.operations.LockOperation{
serviceName='hz:impl:lockService', callId=2854669, invocationTime=1441146297670, waitTimeout=-900001, callTimeout=60000},
partitionId=215, replicaIndex=0, tryCount=250, tryPauseMillis=500, invokeCount=0, callTimeout=60000,
target=Address[*.*.*.*]:****, backupsExpected=0, backupsCompleted=0} was interrupted
at com.hazelcast.util.ExceptionUtil.rethrow(ExceptionUtil.java:52)
at com.hazelcast.spi.impl.BasicInvocationFuture.getSafely(BasicInvocationFuture.java:200)
at com.hazelcast.concurrent.lock.LockProxySupport.lock(LockProxySupport.java:79)
at com.hazelcast.concurrent.lock.LockProxySupport.lock(LockProxySupport.java:73)
at com.hazelcast.map.impl.proxy.MapProxyImpl.lock(MapProxyImpl.java:256)
的CL生產中的uster由兩個節點組成。
我無法在本地重現此問題。
我讀過一個類似的例外,它與應用程序服務器的時鐘時間有兩個遠不同步,但我不是這種情況。
任何人都可以解釋爲什麼發生這種情況?
看來我對IMap的使用非常簡單。