2013-03-26 49 views
0

我在集羣中使用了hazelcast -2.5。我試圖在我的Hazelcast Map(String,ArrayList)的存儲加載實現中加載用戶定義對象的ArrayList(帶有幾個String字段和一個Integer)。所有初始加載不會給我任何例外。但是,如果由於地圖上的get調用而導致負載被調用(對於其中沒有值的鍵),我看到下面的異常被拋出(我也在執行remove該時間點之後,在地圖上操作):在使用Hazelcast(Java)時CONCURRENT_MAP_REMOVE存儲引發的異常

Store thrown exception for CONCURRENT_MAP_REMOVE 

它給了我一個類轉換異常,說明我的UD對象不能轉換爲字符串。如果我在實現中遺漏了某些東西,我不會感到驚訝 - 只是在進行此調用時,我正試圖在地圖上執行get操作並將結果分配給用戶定義對象的ArrayList。商店負載中的加載操作也返回用戶定義對象的ArrayList(商店負載以相同的方式聲明)。

WARNING: [192.168.1.1]:5703 [dev] Store thrown exception for CONCURRENT_MAP_REMOVE 
java.lang.ClassCastException: models.test.TestClass cannot be cast to java.lang.String 
    at models.test.StoreLoadTestMap.load(StoreLoadTestMap.java:1) 
    at com.hazelcast.impl.concurrentmap.MapStoreWrapper.load(MapStoreWrapper.java:143) 
    at com.hazelcast.impl.ConcurrentMapManager$RemoveOperationHandler$RemoveLoader.doMapStoreOperation(ConcurrentMapManager.java:2681) 
    at com.hazelcast.impl.ConcurrentMapManager$AbstractMapStoreOperation.run(ConcurrentMapManager.java:3860) 
    at com.hazelcast.impl.executor.ParallelExecutorService$ParallelExecutorImpl$ExecutionSegment.run(ParallelExecutorService.java:212) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
    at com.hazelcast.impl.ExecutorThreadFactory$1.run(ExecutorThreadFactory.java:38) 

有關解決此問題的任何想法?

+0

我需要確認,但似乎我會得到這個異常,如果從加載操作(在商店負載實施)返回arraylist是空的。 – 2013-03-26 22:15:39

回答

0

如果從hazelcast加載操作(在存儲加載實現中)返回的ArrayList爲空,您將看到此異常。