Hazelcast - cannot make remote call: ContainsKeyOperation

天大地大妈咪最大 提交于 2019-12-13 18:05:19

问题


The error is purely the title. Any call I do to containsKey in a map retrieved from Hazelcast I get this specific error. Example below:

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"

The stack after the exception

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)

The error occurs when I call containsKey inside if statement.


回答1:


It is not allowed to make operations from MapStore interface methods in case of write through. Because writethrough map store operations run on partition thread, and using another partition based operation(like Containskey) can cause deadlock. That is why we have a check and an exception there.



来源:https://stackoverflow.com/questions/25144077/hazelcast-cannot-make-remote-call-containskeyoperation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!