错误纯粹是标题。我在从Hazelcast检索到的地图中对containsKey进行的任何调用都会收到此特定错误。示例如下:
val structuresMapStore : IMap[ String, Object ] = instance.getMap( MapNames.Structures )
if ( structuresMapStore.containsKey( uuidModel ) ) {
logger.info( "\n\n Server - Dropping map: " + uuidModel + "\n\n" )
structuresMapStore.remove( uuidModel )
instance.getMap( uuidModel ).destroy()
return "SUCCESS"
}
return "FAIL"
异常后的堆栈
Aug 05, 2014 1:15:24 PM com.hazelcast.map.operation.ContainsKeyOperation
SEVERE: [192.168.122.1]:5701 [dev] [3.3-RC2] Thread[hz._hzInstance_2_dev.partition- operation.thread-12,5,_hzInstance_2_dev] cannot make remote call: ContainsKeyOperation{}
java.lang.IllegalThreadStateException: Thread[hz._hzInstance_2_dev.partition-operation.thread-12,5,_hzInstance_2_dev] cannot make remote call: ContainsKeyOperation{}
at com.hazelcast.spi.impl.BasicInvocation.invoke(BasicInvocation.java:230)
at com.hazelcast.spi.impl.BasicOperationService.invokeOnPartition(BasicOperationService.java:237)
at com.hazelcast.map.proxy.MapProxySupport.containsKeyInternal(MapProxySupport.java:560)
at com.hazelcast.map.proxy.MapProxyImpl.containsKey(MapProxyImpl.java:236)
at com.utils.hazelcast.HazelcastUtils$.getPersistence(HazelcastUtils.scala:14)
at com.utils.hazelcast.mapstore.UniDataModelMapStore.load(UniDataModelMapStore.scala:31)
at com.utils.hazelcast.mapstore.UniDataModelMapStore.load(UniDataModelMapStore.scala:18)
at com.hazelcast.map.MapStoreWrapper.load(MapStoreWrapper.java:121)
at com.hazelcast.map.mapstore.writethrough.WriteThroughStore.load(WriteThroughStore.java:78)
at com.hazelcast.map.mapstore.writethrough.WriteThroughStore.load(WriteThroughStore.java:31)
at com.hazelcast.map.DefaultRecordStore.containsKey(DefaultRecordStore.java:603)
at com.hazelcast.map.operation.ContainsKeyOperation.run(ContainsKeyOperation.java:33)
at com.hazelcast.spi.impl.BasicOperationService$OperationHandler.handle(BasicOperationService.java:673)
at com.hazelcast.spi.impl.BasicOperationService$OperationHandler.access$400(BasicOperationService.java:649)
at com.hazelcast.spi.impl.BasicOperationService$BasicDispatcherImpl.dispatch(BasicOperationService.java:527)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.process(BasicOperationScheduler.java:428)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.doRun(BasicOperationScheduler.java:422)
at com.hazelcast.spi.impl.BasicOperationScheduler$OperationThread.run(BasicOperationScheduler.java:397)
当我在if语句中调用containsKey时会发生错误。
答案 0 :(得分:3)
在写入时,不允许从MapStore接口方法进行操作。由于writethrough映射存储操作在分区线程上运行,并且使用另一个基于分区的操作(如Containskey)可能导致死锁。这就是我们在那里检查和例外的原因。