本文介绍了Hazelcast-无法进行远程呼叫:ContainsKeyOperation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误纯粹是标题.我对从Hazelcast检索到的地图中的containsKey所做的任何调用都收到此特定错误.下面的示例:

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"

异常后的堆栈

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时发生错误.

The error occurs when I call containsKey inside if statement.

推荐答案

在直写的情况下,不允许通过MapStore接口方法进行操作.因为直写映射存储操作在分区线程上运行,并且使用其他基于分区的操作(如Containskey)可能会导致死锁.这就是为什么我们在那里有检查和异常的原因.

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.

这篇关于Hazelcast-无法进行远程呼叫:ContainsKeyOperation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 13:25